LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
Public Member Functions | Public Attributes | List of all members
lsst::pex::harness::LogUtils Class Reference

Pipeline class manages the operation of a multi-stage parallel pipeline. More...

#include <LogUtils.h>

Public Member Functions

 LogUtils ()
 
 ~LogUtils ()
 
void initializeLogger (bool isLocalLogMode, const std::string &name, const std::string &runId, const std::string &logdir, const std::string &workerid, int resourceUsageFlags=0)
 
void initializeSliceLogger (bool isLocalLogMode, const std::string &name, const std::string &runId, const std::string &logdir, const int rank, const std::string &workerid, int resourceUsageFlags=0)
 
lsst::pex::logging::BlockTimingLoggetLogger ()
 
void setEventBrokerHost (const std::string &host)
 
const std::string & getEventBrokerHost ()
 

Public Attributes

lsst::pex::logging::BlockTimingLog pipelineLog
 
std::string _evbHost
 
std::ofstream * outlog
 

Detailed Description

Pipeline class manages the operation of a multi-stage parallel pipeline.

Pipeline spawns Slice workers and coordinates serial and parallel processing between the main thread and the workers by means of MPI communciations. Pipeline loops over the collection of Stages for processing on Image. The Pipeline is configured by reading a Policy file.

Definition at line 59 of file LogUtils.h.

Constructor & Destructor Documentation

lsst::pex::harness::LogUtils::LogUtils ( )

Constructor.

Definition at line 56 of file LogUtils.cc.

57  : pipelineLog(Log::getDefaultLog(),"harness"), _evbHost(""), outlog(0)
58 { }
static Log & getDefaultLog()
lsst::pex::logging::BlockTimingLog pipelineLog
Definition: LogUtils.h:92
std::ofstream * outlog
Definition: LogUtils.h:94
lsst::pex::harness::LogUtils::~LogUtils ( void  )

Destructor.

Definition at line 62 of file LogUtils.cc.

62  {
63  delete outlog;
64 }
std::ofstream * outlog
Definition: LogUtils.h:94

Member Function Documentation

const std::string& lsst::pex::harness::LogUtils::getEventBrokerHost ( )
inline

Definition at line 90 of file LogUtils.h.

90 { return _evbHost; }
lsst::pex::logging::BlockTimingLog& lsst::pex::harness::LogUtils::getLogger ( )
inline

Definition at line 83 of file LogUtils.h.

83  {
84  return pipelineLog;
85  }
lsst::pex::logging::BlockTimingLog pipelineLog
Definition: LogUtils.h:92
void lsst::pex::harness::LogUtils::initializeLogger ( bool  isLocalLogMode,
const std::string &  name,
const std::string &  runId,
const std::string &  logdir,
const std::string &  workerid,
int  resourceUsageFlags = 0 
)

Initialize the logger "pipelineLog" to be used globally in the Pipeline class. Add an ofstream Destination to the default logger if the localLogMode is True local file is on

Parameters
isLocalLogModeA flag for writing logs to local files

Definition at line 70 of file LogUtils.cc.

76  {
77  std::stringstream logfileBuffer;
78  std::string logfile;
79 
80  if (logdir.length() > 0) {
81  logfileBuffer << logdir;
82  logfileBuffer << "/";
83  }
84 
85  logfileBuffer << "Pipeline.log";
86  logfileBuffer >> logfile;
87 
88  if(isLocalLogMode) {
89  /* Make output file stream */
90  outlog = new ofstream(logfile.c_str());
91  }
92 
93  /* Create LSSTLogging transmitter here. (Moved from setupHarnessLogging in TracingLog.cc
94  Need to re-check this for MPI SLices. */
95  if (_evbHost.length() > 0) {
97  /* eventSystem.createTransmitter(_evbHost, EventLog::LOGGING_TOPIC); */
98  eventSystem.createTransmitter(_evbHost, "logging");
99  }
100 
101  boost::shared_ptr<BlockTimingLog>
102  lp(setupHarnessLogging(std::string(runId), -1, _evbHost, name, workerid,
103  outlog, "harness.pipeline",resourceUsageFlags));
104 
105 
106  pipelineLog = *lp;
107 
109  "Pipeline Logger initialized for pid=%d", getpid());
110  if (outlog)
111  pipelineLog.format(Log::INFO, "replicating messages to %s", logfile.c_str());
112 }
void createTransmitter(const pexPolicy::Policy &policy)
create an EventTransmitter to send messages to the message broker
Definition: EventSystem.cc:115
void format(int importance, const char *fmt,...)
static EventSystem & getDefaultEventSystem()
return the default EventSystem object, which can access all previously created Transmitters and recei...
Definition: EventSystem.cc:80
static const int INFO
Definition: Log.h:171
lsst::pex::logging::BlockTimingLog pipelineLog
Definition: LogUtils.h:92
std::ofstream * outlog
Definition: LogUtils.h:94
BlockTimingLog * setupHarnessLogging(const std::string &runId, int sliceId, const std::string &eventBrokerHost, const std::string &pipename, const std::string &workerid, std::ostream *messageStrm, const std::string &logname, int resourceUsageFlags)
create and configure logging for a harness application
Definition: LogUtils.cc:168
Coordinate publishing and receiving events.
Definition: EventSystem.h:65
void lsst::pex::harness::LogUtils::initializeSliceLogger ( bool  isLocalLogMode,
const std::string &  name,
const std::string &  runId,
const std::string &  logdir,
const int  rank,
const std::string &  workerid,
int  resourceUsageFlags = 0 
)

Initialize the logger "sliceLog" to be used globally in the Slice class. Add an ofstreamDestination to the default logger if the localLogMode is True

Parameters
isLocalLogModeA flag for writing logs to local files

Definition at line 117 of file LogUtils.cc.

125 {
126  std::string logfile;
127  if(isLocalLogMode) {
128  /* Make a log file name coded to the rank */
129  std::stringstream logfileBuffer;
130 
131  if (logdir.length() > 0) {
132  logfileBuffer << logdir;
133  logfileBuffer << "/";
134  }
135 
136  logfileBuffer << "Slice";
137  logfileBuffer << rank;
138  logfileBuffer << ".log";
139 
140  logfileBuffer >> logfile;
141 
142  /* Make output file stream */
143  outlog = new ofstream(logfile.c_str());
144  }
145 
146 
147  boost::shared_ptr<BlockTimingLog>
148  lp(setupHarnessLogging(std::string(runId), rank, _evbHost,
149  name, workerid, outlog, "harness.slice",
150  resourceUsageFlags));
151  pipelineLog = *lp;
152 
153  pipelineLog.format(Log::INFO, "Slice Logger initialized for pid=%d", getpid());
154 
155  if (outlog)
157  "replicating messages to %s", logfile.c_str());
158 }
void format(int importance, const char *fmt,...)
static const int INFO
Definition: Log.h:171
lsst::pex::logging::BlockTimingLog pipelineLog
Definition: LogUtils.h:92
std::ofstream * outlog
Definition: LogUtils.h:94
BlockTimingLog * setupHarnessLogging(const std::string &runId, int sliceId, const std::string &eventBrokerHost, const std::string &pipename, const std::string &workerid, std::ostream *messageStrm, const std::string &logname, int resourceUsageFlags)
create and configure logging for a harness application
Definition: LogUtils.cc:168
void lsst::pex::harness::LogUtils::setEventBrokerHost ( const std::string &  host)
inline

Definition at line 87 of file LogUtils.h.

87  {
88  _evbHost = host;
89  }

Member Data Documentation

std::string lsst::pex::harness::LogUtils::_evbHost

Definition at line 93 of file LogUtils.h.

std::ofstream* lsst::pex::harness::LogUtils::outlog

Definition at line 94 of file LogUtils.h.

lsst::pex::logging::BlockTimingLog lsst::pex::harness::LogUtils::pipelineLog

Definition at line 92 of file LogUtils.h.


The documentation for this class was generated from the following files: