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
Namespaces | Classes | Functions
lsst::pex::harness Namespace Reference

Namespaces

 Clipboard
 
 dataset
 
 Directories
 
 EventStage
 
 IOStage
 
 Pipeline
 
 Queue
 
 run
 
 ShutdownThread
 
 simpleStageTester
 
 Slice
 
 SliceThread
 
 stage
 
 startPipeline
 
 
 Utils
 
 version
 

Classes

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

Functions

BlockTimingLogsetupHarnessLogging (const std::string &runId, int sliceId, const std::string &eventBrokerHost="", const std::string &pipename="unnamed", const std::string &workerid="-1", std::ostream *messageStrm=0, const std::string &logname="harness", int resourceUsageFlags=0)
 create and configure logging for a harness application More...
 
TracingLogsetupHarnessLogging (const std::string &runId, int sliceId, const std::string &eventBrokerHost="", const std::string &pipename="unnamed", const std::string &workerid="-1", std::ostream *messageStrm=0, const std::string &logname="harness")
 create and configure logging for a harness application More...
 

Function Documentation

TracingLog * lsst::pex::harness::setupHarnessLogging ( const std::string &  runId,
int  sliceId,
const std::string &  eventBrokerHost = "",
const std::string &  pipename = "unnamed",
const std::string &  workerid = "-1",
std::ostream *  messageStrm = 0,
const std::string &  logname = "harness" 
)

create and configure logging for a harness application

This will create and configure a default log needed to send all log messages through the event system. It then creates a child log to be used by a harness class instance (i.e. Pipeline or Slice).

Parameters
runIdthe production run identifier that harness is running under
sliceIdthe slice identifier (-1 for the master process)
eventBrokerHostthe hostname where the desired event broker is running
pipenamethe name used to identify the pipeline
messageStrmif non-null, a (file) stream to replicate the messages in.
lognamethe name to give to the harness logger (default: "harness")

Definition at line 71 of file TracingLog.cc.

77 {
78  if (eventBrokerHost.length() > 0) {
79  /* Move this to LogUtils.cc and only call for the Pipeline
80  Re-examine this for MPI Slices
81  EventSystem& eventSystem = EventSystem::getDefaultEventSystem();
82  eventSystem.createTransmitter(eventBrokerHost, "LSSTLogging");
83  */
84  EventLog::createDefaultLog(runId, sliceId);
85  }
86  Log& root = Log::getDefaultLog();
87  root.addPreambleProperty("PIPELINE", pipename);
88  root.addPreambleProperty("workerid", workerid);
89 
90  if (messageStrm != 0) {
91  boost::shared_ptr<LogFormatter> frmtr(new IndentedFormatter(true));
92  boost::shared_ptr<LogDestination>
93  dest(new LogDestination(messageStrm, frmtr, Log::DEBUG));
94  root.addDestination(dest);
95  }
96 
97  TracingLog *out = 0;
98  try {
99  out = new TracingLog(root, logname);
100  out->format(Log::INFO,
101  "Harness Logger initialized with message threshold = %i",
102  out->getThreshold());
103  return out;
104  }
105  catch (...) {
106  delete out;
107  throw;
108  }
109 }
lsst::pex::logging::BlockTimingLog * lsst::pex::harness::setupHarnessLogging ( const std::string &  runId,
int  sliceId,
const std::string &  eventBrokerHost = "",
const std::string &  pipename = "unnamed",
const std::string &  workerid = "-1",
std::ostream *  messageStrm = 0,
const std::string &  logname = "harness",
int  resourceUsageFlags = 0 
)

create and configure logging for a harness application

This will create and configure a default log needed to send all log messages through the event system. It then creates a child log to be used by a harness class instance (i.e. Pipeline or Slice).

Parameters
runIdthe production run identifier that harness is running under
sliceIdthe slice identifier (-1 for the master process)
eventBrokerHostthe hostname where the desired event broker is running
pipenamethe name used to identify the pipeline
messageStrmif non-null, a (file) stream to replicate the messages in.
lognamethe name to give to the harness logger (default: "harness")
resourceUsageFlagsthe OR-ed flags that control the resource usage data to collect; see BlockTimingLog. (default: NOUDATA, no resource usage data.)

Definition at line 168 of file LogUtils.cc.

175 {
176  if (eventBrokerHost.length() > 0) {
177  /* Move this to LogUtils.cc and only call for the Pipeline
178  Re-examine this for MPI Slices
179  EventSystem& eventSystem = EventSystem::getDefaultEventSystem();
180  eventSystem.createTransmitter(eventBrokerHost, "LSSTLogging");
181  */
182  EventLog::createDefaultLog(runId, sliceId);
183  }
184  Log& root = Log::getDefaultLog();
185  root.addPreambleProperty("PIPELINE", pipename);
186  root.addPreambleProperty("workerid", workerid);
187 
188  if (messageStrm != 0) {
189  boost::shared_ptr<LogFormatter> frmtr(new IndentedFormatter(true));
190  boost::shared_ptr<LogDestination>
191  dest(new LogDestination(messageStrm, frmtr, Log::DEBUG));
192  root.addDestination(dest);
193  }
194 
195  BlockTimingLog *out = 0;
196  try {
197  out = new BlockTimingLog(root, logname);
198  out->setUsageFlags(resourceUsageFlags);
199  out->format(Log::INFO,
200  "Harness Logger initialized with message threshold = %i",
201  out->getThreshold());
202  return out;
203  }
204  catch (...) {
205  delete out;
206  throw;
207  }
208 }
int getThreshold() const
Definition: Log.h:281
void format(int importance, const char *fmt,...)
a place to record messages and descriptions of the state of processing.
Definition: Log.h:154
void addDestination(std::ostream &destination, int threshold)
void addPreambleProperty(const std::string &name, const T &val)
Definition: Log.h:694