CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
edm::Path Class Reference

#include <Path.h>

Public Types

typedef WorkersInPath::size_type size_type
 
typedef hlt::HLTState State
 
typedef boost::shared_ptr
< HLTGlobalStatus
TrigResPtr
 
typedef std::vector< WorkerInPathWorkersInPath
 

Public Member Functions

int bitPosition () const
 
void clearCounters ()
 
Worker const * getWorker (size_type i) const
 
std::string const & name () const
 
 Path (int bitpos, std::string const &path_name, WorkersInPath const &workers, TrigResPtr trptr, ExceptionToActionTable const &actions, boost::shared_ptr< ActivityRegistry > reg, StreamContext const *streamContext, PathContext::PathType pathType)
 
 Path (Path const &)
 
template<typename T >
void processOneOccurrence (typename T::MyPrincipal &, EventSetup const &, StreamID const &, typename T::Context const *)
 
void setEarlyDeleteHelpers (std::map< const Worker *, EarlyDeleteHelper * > const &)
 
size_type size () const
 
State state () const
 
std::pair< double, double > timeCpuReal () const
 
std::pair< double, double > timeCpuReal (unsigned int const i) const
 
int timesExcept () const
 
int timesExcept (size_type i) const
 
int timesFailed () const
 
int timesFailed (size_type i) const
 
int timesPassed () const
 
int timesPassed (size_type i) const
 
int timesRun () const
 
int timesVisited (size_type i) const
 
void useStopwatch ()
 

Private Member Functions

void handleEarlyFinish (EventPrincipal &)
 
void handleEarlyFinish (RunPrincipal &)
 
void handleEarlyFinish (LuminosityBlockPrincipal &)
 
bool handleWorkerFailure (cms::Exception &e, int nwrwue, bool isEvent, bool begin, BranchType branchType, ModuleDescription const &, std::string const &id)
 
Path const & operator= (Path const &)=delete
 
void recordStatus (int nwrwue, bool isEvent)
 
void updateCounters (bool succeed, bool isEvent)
 

Static Private Member Functions

static void exceptionContext (cms::Exception &ex, bool isEvent, bool begin, BranchType branchType, ModuleDescription const &, std::string const &id, PathContext const &)
 

Private Attributes

ExceptionToActionTable const * act_table_
 
boost::shared_ptr
< ActivityRegistry
actReg_
 
int bitpos_
 
std::vector< EarlyDeleteHelper * > earlyDeleteHelpers_
 
PathContext pathContext_
 
State state_
 
RunStopwatch::StopwatchPointer stopwatch_
 
int timesExcept_
 
int timesFailed_
 
int timesPassed_
 
int timesRun_
 
TrigResPtr trptr_
 
WorkersInPath workers_
 

Detailed Description

Definition at line 42 of file Path.h.

Member Typedef Documentation

typedef WorkersInPath::size_type edm::Path::size_type

Definition at line 47 of file Path.h.

Definition at line 44 of file Path.h.

typedef boost::shared_ptr<HLTGlobalStatus> edm::Path::TrigResPtr

Definition at line 48 of file Path.h.

typedef std::vector<WorkerInPath> edm::Path::WorkersInPath

Definition at line 46 of file Path.h.

Constructor & Destructor Documentation

edm::Path::Path ( int  bitpos,
std::string const &  path_name,
WorkersInPath const &  workers,
TrigResPtr  trptr,
ExceptionToActionTable const &  actions,
boost::shared_ptr< ActivityRegistry reg,
StreamContext const *  streamContext,
PathContext::PathType  pathType 
)

Definition at line 13 of file Path.cc.

References pathContext_, and workers_.

19  :
20  stopwatch_(),
21  timesRun_(),
22  timesPassed_(),
23  timesFailed_(),
24  timesExcept_(),
26  bitpos_(bitpos),
27  trptr_(trptr),
28  actReg_(areg),
30  workers_(workers),
31  pathContext_(path_name, streamContext, bitpos, pathType) {
32 
33  for (auto& workerInPath : workers_) {
34  workerInPath.setPathContext(&pathContext_);
35  }
36  }
not [yet] run
Definition: HLTenums.h:18
int timesFailed_
Definition: Path.h:106
int timesExcept_
Definition: Path.h:107
PathContext pathContext_
Definition: Path.h:119
actions
Definition: Schedule.cc:369
TrigResPtr trptr_
Definition: Path.h:112
int bitpos_
Definition: Path.h:111
areg
Definition: Schedule.cc:369
boost::shared_ptr< ActivityRegistry > actReg_
Definition: Path.h:113
WorkersInPath workers_
Definition: Path.h:116
RunStopwatch::StopwatchPointer stopwatch_
Definition: Path.h:103
ExceptionToActionTable const * act_table_
Definition: Path.h:114
State state_
Definition: Path.h:109
int timesPassed_
Definition: Path.h:105
int timesRun_
Definition: Path.h:104
edm::Path::Path ( Path const &  r)

Definition at line 38 of file Path.cc.

References pathContext_, and workers_.

38  :
39  stopwatch_(r.stopwatch_),
40  timesRun_(r.timesRun_),
41  timesPassed_(r.timesPassed_),
42  timesFailed_(r.timesFailed_),
43  timesExcept_(r.timesExcept_),
44  state_(r.state_),
45  bitpos_(r.bitpos_),
46  trptr_(r.trptr_),
47  actReg_(r.actReg_),
48  act_table_(r.act_table_),
49  workers_(r.workers_),
50  earlyDeleteHelpers_(r.earlyDeleteHelpers_),
51  pathContext_(r.pathContext_) {
52 
53  for (auto& workerInPath : workers_) {
54  workerInPath.setPathContext(&pathContext_);
55  }
56  }
std::vector< EarlyDeleteHelper * > earlyDeleteHelpers_
Definition: Path.h:117
int timesFailed_
Definition: Path.h:106
int timesExcept_
Definition: Path.h:107
PathContext pathContext_
Definition: Path.h:119
TrigResPtr trptr_
Definition: Path.h:112
int bitpos_
Definition: Path.h:111
boost::shared_ptr< ActivityRegistry > actReg_
Definition: Path.h:113
WorkersInPath workers_
Definition: Path.h:116
RunStopwatch::StopwatchPointer stopwatch_
Definition: Path.h:103
ExceptionToActionTable const * act_table_
Definition: Path.h:114
State state_
Definition: Path.h:109
int timesPassed_
Definition: Path.h:105
int timesRun_
Definition: Path.h:104

Member Function Documentation

int edm::Path::bitPosition ( ) const
inline

Definition at line 64 of file Path.h.

References bitpos_.

Referenced by edm::fillPathSummary(), and edm::fillPathTimingSummary().

64 { return bitpos_; }
int bitpos_
Definition: Path.h:111
void edm::Path::clearCounters ( )

Definition at line 161 of file Path.cc.

References edm::WorkerInPath::clearCounters(), edm::for_all(), timesExcept_, timesFailed_, timesPassed_, timesRun_, and workers_.

Referenced by edm::StreamSchedule::clearCounters().

161  {
163  for_all(workers_, boost::bind(&WorkerInPath::clearCounters, _1));
164  }
int timesFailed_
Definition: Path.h:106
int timesExcept_
Definition: Path.h:107
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
WorkersInPath workers_
Definition: Path.h:116
int timesPassed_
Definition: Path.h:105
int timesRun_
Definition: Path.h:104
void edm::Path::exceptionContext ( cms::Exception ex,
bool  isEvent,
bool  begin,
BranchType  branchType,
ModuleDescription const &  desc,
std::string const &  id,
PathContext const &  pathContext 
)
staticprivate

Definition at line 104 of file Path.cc.

References cms::Exception::addContext(), edm::InLumi, edm::InRun, edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), and edm::PathContext::pathName().

Referenced by handleWorkerFailure().

110  {
111  std::ostringstream ost;
112  if (isEvent) {
113  ost << "Calling event method";
114  }
115  else if (begin && branchType == InRun) {
116  ost << "Calling beginRun";
117  }
118  else if (begin && branchType == InLumi) {
119  ost << "Calling beginLuminosityBlock";
120  }
121  else if (!begin && branchType == InLumi) {
122  ost << "Calling endLuminosityBlock";
123  }
124  else if (!begin && branchType == InRun) {
125  ost << "Calling endRun";
126  }
127  else {
128  // It should be impossible to get here ...
129  ost << "Calling unknown function";
130  }
131  ost << " for module " << desc.moduleName() << "/'" << desc.moduleLabel() << "'";
132  ex.addContext(ost.str());
133  ost.str("");
134  ost << "Running path '" << pathContext.pathName() << "'";
135  ex.addContext(ost.str());
136  ost.str("");
137  ost << "Processing ";
138  ost << id;
139  ex.addContext(ost.str());
140  }
void addContext(std::string const &context)
Definition: Exception.cc:227
#define begin
Definition: vmac.h:30
Worker const* edm::Path::getWorker ( size_type  i) const
inline

Definition at line 92 of file Path.h.

References workers_.

Referenced by edm::fillModuleInPathSummary(), edm::fillModuleInPathTimingSummary(), and setEarlyDeleteHelpers().

92 { return workers_.at(i).getWorker(); }
int i
Definition: DBlmapReader.cc:9
WorkersInPath workers_
Definition: Path.h:116
void edm::Path::handleEarlyFinish ( EventPrincipal iEvent)
private

Definition at line 194 of file Path.cc.

References earlyDeleteHelpers_.

Referenced by processOneOccurrence().

194  {
195  for(auto helper: earlyDeleteHelpers_) {
196  helper->pathFinished(iEvent);
197  }
198  }
std::vector< EarlyDeleteHelper * > earlyDeleteHelpers_
Definition: Path.h:117
int iEvent
Definition: GenABIO.cc:230
void edm::Path::handleEarlyFinish ( RunPrincipal )
inlineprivate

Definition at line 141 of file Path.h.

141 {}
void edm::Path::handleEarlyFinish ( LuminosityBlockPrincipal )
inlineprivate

Definition at line 142 of file Path.h.

142 {}
bool edm::Path::handleWorkerFailure ( cms::Exception e,
int  nwrwue,
bool  isEvent,
bool  begin,
BranchType  branchType,
ModuleDescription const &  desc,
std::string const &  id 
)
private

Definition at line 60 of file Path.cc.

References act_table_, alignCSCRings::action, cms::Exception::addAdditionalInfo(), cms::Exception::category(), edm::Exception::codeToString(), edm::hlt::Exception, exceptionContext(), edm::exception_actions::FailPath, edm::ExceptionToActionTable::find(), pathContext_, edm::printCmsExceptionWarning(), edm::errors::ProductNotFound, recordStatus(), edm::exception_actions::Rethrow, state_, AlCaHLTBitMon_QueryRunRegistry::string, and timesExcept_.

Referenced by processOneOccurrence().

66  {
67 
68  exceptionContext(e, isEvent, begin, branchType, desc, id, pathContext_);
69 
70  bool should_continue = true;
71 
72  // there is no support as of yet for specific paths having
73  // different exception behavior
74 
75  // If not processing an event, always rethrow.
77  switch(action) {
79  should_continue = false;
80  edm::printCmsExceptionWarning("FailPath", e);
81  break;
82  }
83  default: {
84  if (isEvent) ++timesExcept_;
86  recordStatus(nwrwue, isEvent);
87  if (action == exception_actions::Rethrow) {
89  if (e.category() == pNF) {
90  std::ostringstream ost;
91  ost << "If you wish to continue processing events after a " << pNF << " exception,\n" <<
92  "add \"SkipEvent = cms.untracked.vstring('ProductNotFound')\" to the \"options\" PSet in the configuration.\n";
93  e.addAdditionalInfo(ost.str());
94  }
95  }
96  throw;
97  }
98  }
99 
100  return should_continue;
101  }
void recordStatus(int nwrwue, bool isEvent)
Definition: Path.cc:143
std::string const & category() const
Definition: Exception.cc:183
exception_actions::ActionCodes find(const std::string &category) const
int timesExcept_
Definition: Path.h:107
PathContext pathContext_
Definition: Path.h:119
void printCmsExceptionWarning(char const *behavior, cms::Exception const &e, edm::JobReport *jobRep=0, int rc=-1)
void addAdditionalInfo(std::string const &info)
Definition: Exception.cc:235
static std::string codeToString(Code)
-----------— implementation details ---------------—
Definition: EDMException.cc:55
static void exceptionContext(cms::Exception &ex, bool isEvent, bool begin, BranchType branchType, ModuleDescription const &, std::string const &id, PathContext const &)
Definition: Path.cc:104
ExceptionToActionTable const * act_table_
Definition: Path.h:114
State state_
Definition: Path.h:109
#define begin
Definition: vmac.h:30
std::string const& edm::Path::name ( void  ) const
inline
Path const& edm::Path::operator= ( Path const &  )
privatedelete
template<typename T >
void edm::Path::processOneOccurrence ( typename T::MyPrincipal &  ep,
EventSetup const &  es,
StreamID const &  streamID,
typename T::Context const *  context 
)

Definition at line 169 of file Path.h.

References actReg_, end, handleEarlyFinish(), handleWorkerFailure(), i, pathContext_, edm::hlt::Ready, recordStatus(), state_, stopwatch_, timesRun_, updateCounters(), workers_, and edm::convertException::wrap().

170  {
171 
172  //Create the PathSignalSentry before the RunStopwatch so that
173  // we only record the time spent in the path not from the signal
174  int nwrwue = -1;
175  PathSignalSentry<T> signaler(actReg_.get(), nwrwue, state_, &pathContext_);
176 
177  // A RunStopwatch, but only if we are processing an event.
178  RunStopwatch stopwatch(T::isEvent_ ? stopwatch_ : RunStopwatch::StopwatchPointer());
179 
180  if (T::isEvent_) {
181  ++timesRun_;
182  }
183  state_ = hlt::Ready;
184 
185  // nwrue = numWorkersRunWithoutUnhandledException
186  bool should_continue = true;
187 
188  for (WorkersInPath::iterator i = workers_.begin(), end = workers_.end();
189  i != end && should_continue;
190  ++i) {
191  ++nwrwue;
192  try {
193  convertException::wrap([&]() {
194  if(T::isEvent_) {
195  should_continue = i->runWorker<T>(ep, es, streamID, context);
196  } else {
197  should_continue = i->runWorker<T>(ep, es, streamID, context);
198  }
199  });
200  }
201  catch(cms::Exception& ex) {
202  // handleWorkerFailure may throw a new exception.
203  std::ostringstream ost;
204  ost << ep.id();
205  should_continue = handleWorkerFailure(ex, nwrwue, T::isEvent_, T::begin_, T::branchType_,
206  i->getWorker()->description(), ost.str());
207  }
208  }
209  if (not should_continue) {
210  handleEarlyFinish(ep);
211  }
212  updateCounters(should_continue, T::isEvent_);
213  recordStatus(nwrwue, T::isEvent_);
214  }
int i
Definition: DBlmapReader.cc:9
void recordStatus(int nwrwue, bool isEvent)
Definition: Path.cc:143
void handleEarlyFinish(EventPrincipal &)
Definition: Path.cc:194
not [yet] run
Definition: HLTenums.h:18
PathContext pathContext_
Definition: Path.h:119
boost::shared_ptr< CPUTimer > StopwatchPointer
Definition: RunStopwatch.h:22
#define end
Definition: vmac.h:37
boost::shared_ptr< ActivityRegistry > actReg_
Definition: Path.h:113
WorkersInPath workers_
Definition: Path.h:116
void updateCounters(bool succeed, bool isEvent)
Definition: Path.cc:150
bool handleWorkerFailure(cms::Exception &e, int nwrwue, bool isEvent, bool begin, BranchType branchType, ModuleDescription const &, std::string const &id)
Definition: Path.cc:60
RunStopwatch::StopwatchPointer stopwatch_
Definition: Path.h:103
State state_
Definition: Path.h:109
auto wrap(F iFunc) -> decltype(iFunc())
long double T
int timesRun_
Definition: Path.h:104
void edm::Path::recordStatus ( int  nwrwue,
bool  isEvent 
)
private

Definition at line 143 of file Path.cc.

References bitpos_, state_, and trptr_.

Referenced by handleWorkerFailure(), and processOneOccurrence().

143  {
144  if(isEvent && trptr_) {
145  (*trptr_)[bitpos_]=HLTPathStatus(state_, nwrwue);
146  }
147  }
TrigResPtr trptr_
Definition: Path.h:112
int bitpos_
Definition: Path.h:111
State state_
Definition: Path.h:109
void edm::Path::setEarlyDeleteHelpers ( std::map< const Worker *, EarlyDeleteHelper * > const &  iWorkerToDeleter)

Definition at line 177 of file Path.cc.

References earlyDeleteHelpers_, newFWLiteAna::found, getWorker(), cmsHarvester::index, size(), and groupFilesInBlocks::temp.

177  {
178  //we use a temp so we can overset the size but then when moving to earlyDeleteHelpers we only
179  // have to use the space necessary
180  std::vector<EarlyDeleteHelper*> temp;
181  temp.reserve(iWorkerToDeleter.size());
182  for(unsigned int index=0; index !=size();++index) {
183  auto found = iWorkerToDeleter.find(getWorker(index));
184  if(found != iWorkerToDeleter.end()) {
185  temp.push_back(found->second);
186  found->second->addedToPath();
187  }
188  }
189  std::vector<EarlyDeleteHelper*> tempCorrectSize(temp.begin(),temp.end());
190  earlyDeleteHelpers_.swap(tempCorrectSize);
191  }
std::vector< EarlyDeleteHelper * > earlyDeleteHelpers_
Definition: Path.h:117
size_type size() const
Definition: Path.h:87
Worker const * getWorker(size_type i) const
Definition: Path.h:92
size_type edm::Path::size ( void  ) const
inline

Definition at line 87 of file Path.h.

References workers_.

Referenced by edm::fillPathSummary(), edm::fillPathTimingSummary(), and setEarlyDeleteHelpers().

87 { return workers_.size(); }
WorkersInPath workers_
Definition: Path.h:116
State edm::Path::state ( ) const
inline

Definition at line 85 of file Path.h.

References state_.

85 { return state_; }
State state_
Definition: Path.h:109
std::pair<double, double> edm::Path::timeCpuReal ( ) const
inline

Definition at line 67 of file Path.h.

References stopwatch_.

Referenced by edm::fillModuleInPathTimingSummary(), and edm::fillPathTimingSummary().

67  {
68  if(stopwatch_) {
69  return std::pair<double, double>(stopwatch_->cpuTime(), stopwatch_->realTime());
70  }
71  return std::pair<double, double>(0., 0.);
72  }
RunStopwatch::StopwatchPointer stopwatch_
Definition: Path.h:103
std::pair<double, double> edm::Path::timeCpuReal ( unsigned int const  i) const
inline

Definition at line 74 of file Path.h.

References workers_.

74  {
75  return workers_.at(i).timeCpuReal();
76  }
int i
Definition: DBlmapReader.cc:9
WorkersInPath workers_
Definition: Path.h:116
int edm::Path::timesExcept ( ) const
inline

Definition at line 83 of file Path.h.

References timesExcept_.

Referenced by edm::fillModuleInPathSummary(), and edm::fillPathSummary().

83 { return timesExcept_; }
int timesExcept_
Definition: Path.h:107
int edm::Path::timesExcept ( size_type  i) const
inline

Definition at line 91 of file Path.h.

References workers_.

91 { return workers_.at(i).timesExcept() ; }
int i
Definition: DBlmapReader.cc:9
WorkersInPath workers_
Definition: Path.h:116
int edm::Path::timesFailed ( ) const
inline

Definition at line 82 of file Path.h.

References timesFailed_.

Referenced by edm::fillModuleInPathSummary(), edm::fillModuleInPathTimingSummary(), and edm::fillPathSummary().

82 { return timesFailed_; }
int timesFailed_
Definition: Path.h:106
int edm::Path::timesFailed ( size_type  i) const
inline

Definition at line 90 of file Path.h.

References workers_.

90 { return workers_.at(i).timesFailed() ; }
int i
Definition: DBlmapReader.cc:9
WorkersInPath workers_
Definition: Path.h:116
int edm::Path::timesPassed ( ) const
inline

Definition at line 81 of file Path.h.

References timesPassed_.

Referenced by edm::fillModuleInPathSummary(), and edm::fillPathSummary().

81 { return timesPassed_; }
int timesPassed_
Definition: Path.h:105
int edm::Path::timesPassed ( size_type  i) const
inline

Definition at line 89 of file Path.h.

References workers_.

89 { return workers_.at(i).timesPassed() ; }
int i
Definition: DBlmapReader.cc:9
WorkersInPath workers_
Definition: Path.h:116
int edm::Path::timesRun ( ) const
inline

Definition at line 80 of file Path.h.

References timesRun_.

Referenced by edm::fillPathSummary(), and edm::fillPathTimingSummary().

80 { return timesRun_; }
int timesRun_
Definition: Path.h:104
int edm::Path::timesVisited ( size_type  i) const
inline

Definition at line 88 of file Path.h.

References workers_.

Referenced by edm::fillModuleInPathSummary(), and edm::fillModuleInPathTimingSummary().

88 { return workers_.at(i).timesVisited(); }
int i
Definition: DBlmapReader.cc:9
WorkersInPath workers_
Definition: Path.h:116
void edm::Path::updateCounters ( bool  succeed,
bool  isEvent 
)
private

Definition at line 150 of file Path.cc.

References edm::hlt::Fail, edm::hlt::Pass, state_, timesFailed_, and timesPassed_.

Referenced by processOneOccurrence().

150  {
151  if (success) {
152  if (isEvent) ++timesPassed_;
153  state_ = hlt::Pass;
154  } else {
155  if(isEvent) ++timesFailed_;
156  state_ = hlt::Fail;
157  }
158  }
int timesFailed_
Definition: Path.h:106
reject
Definition: HLTenums.h:20
accept
Definition: HLTenums.h:19
State state_
Definition: Path.h:109
int timesPassed_
Definition: Path.h:105
void edm::Path::useStopwatch ( )

Definition at line 167 of file Path.cc.

References stopwatch_, and workers_.

167  {
168  stopwatch_.reset(new RunStopwatch::StopwatchPointer::element_type);
169  for(WorkersInPath::iterator it=workers_.begin(), itEnd = workers_.end();
170  it != itEnd;
171  ++it) {
172  it->useStopwatch();
173  }
174  }
WorkersInPath workers_
Definition: Path.h:116
RunStopwatch::StopwatchPointer stopwatch_
Definition: Path.h:103

Member Data Documentation

ExceptionToActionTable const* edm::Path::act_table_
private

Definition at line 114 of file Path.h.

Referenced by handleWorkerFailure().

boost::shared_ptr<ActivityRegistry> edm::Path::actReg_
private

Definition at line 113 of file Path.h.

Referenced by processOneOccurrence().

int edm::Path::bitpos_
private

Definition at line 111 of file Path.h.

Referenced by bitPosition(), and recordStatus().

std::vector<EarlyDeleteHelper*> edm::Path::earlyDeleteHelpers_
private

Definition at line 117 of file Path.h.

Referenced by handleEarlyFinish(), and setEarlyDeleteHelpers().

PathContext edm::Path::pathContext_
private

Definition at line 119 of file Path.h.

Referenced by handleWorkerFailure(), name(), Path(), and processOneOccurrence().

State edm::Path::state_
private
RunStopwatch::StopwatchPointer edm::Path::stopwatch_
private

Definition at line 103 of file Path.h.

Referenced by processOneOccurrence(), timeCpuReal(), and useStopwatch().

int edm::Path::timesExcept_
private

Definition at line 107 of file Path.h.

Referenced by clearCounters(), handleWorkerFailure(), and timesExcept().

int edm::Path::timesFailed_
private

Definition at line 106 of file Path.h.

Referenced by clearCounters(), timesFailed(), and updateCounters().

int edm::Path::timesPassed_
private

Definition at line 105 of file Path.h.

Referenced by clearCounters(), timesPassed(), and updateCounters().

int edm::Path::timesRun_
private

Definition at line 104 of file Path.h.

Referenced by clearCounters(), processOneOccurrence(), and timesRun().

TrigResPtr edm::Path::trptr_
private

Definition at line 112 of file Path.h.

Referenced by recordStatus().

WorkersInPath edm::Path::workers_
private