test
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 std::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, std::shared_ptr< ActivityRegistry > reg, StreamContext const *streamContext, PathContext::PathType pathType)
 
 Path (Path const &)
 
template<typename T >
void processOneOccurrence (typename T::MyPrincipal const &, EventSetup const &, StreamID const &, typename T::Context const *)
 
void setEarlyDeleteHelpers (std::map< const Worker *, EarlyDeleteHelper * > const &)
 
size_type size () const
 
State state () 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
 

Private Member Functions

void handleEarlyFinish (EventPrincipal const &)
 
void handleEarlyFinish (RunPrincipal const &)
 
void handleEarlyFinish (LuminosityBlockPrincipal const &)
 
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_
 
std::shared_ptr< ActivityRegistryactReg_
 
int bitpos_
 
std::vector< EarlyDeleteHelper * > earlyDeleteHelpers_
 
PathContext pathContext_
 
State state_
 
int timesExcept_
 
int timesFailed_
 
int timesPassed_
 
int timesRun_
 
TrigResPtr trptr_
 
WorkersInPath workers_
 

Detailed Description

Definition at line 40 of file Path.h.

Member Typedef Documentation

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

Definition at line 45 of file Path.h.

Definition at line 42 of file Path.h.

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

Definition at line 46 of file Path.h.

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

Definition at line 44 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,
std::shared_ptr< ActivityRegistry reg,
StreamContext const *  streamContext,
PathContext::PathType  pathType 
)

Definition at line 12 of file Path.cc.

References pathContext_, and workers_.

18  :
19  timesRun_(),
20  timesPassed_(),
21  timesFailed_(),
22  timesExcept_(),
24  bitpos_(bitpos),
25  trptr_(trptr),
26  actReg_(areg),
28  workers_(workers),
29  pathContext_(path_name, streamContext, bitpos, pathType) {
30 
31  for (auto& workerInPath : workers_) {
32  workerInPath.setPathContext(&pathContext_);
33  }
34  }
not [yet] run
Definition: HLTenums.h:18
int timesFailed_
Definition: Path.h:91
int timesExcept_
Definition: Path.h:92
PathContext pathContext_
Definition: Path.h:104
actions
Definition: Schedule.cc:374
std::shared_ptr< ActivityRegistry > actReg_
Definition: Path.h:98
TrigResPtr trptr_
Definition: Path.h:97
int bitpos_
Definition: Path.h:96
areg
Definition: Schedule.cc:374
WorkersInPath workers_
Definition: Path.h:101
ExceptionToActionTable const * act_table_
Definition: Path.h:99
State state_
Definition: Path.h:94
int timesPassed_
Definition: Path.h:90
int timesRun_
Definition: Path.h:89
edm::Path::Path ( Path const &  r)

Definition at line 36 of file Path.cc.

References pathContext_, and workers_.

36  :
37  timesRun_(r.timesRun_),
38  timesPassed_(r.timesPassed_),
39  timesFailed_(r.timesFailed_),
40  timesExcept_(r.timesExcept_),
41  state_(r.state_),
42  bitpos_(r.bitpos_),
43  trptr_(r.trptr_),
44  actReg_(r.actReg_),
45  act_table_(r.act_table_),
46  workers_(r.workers_),
47  earlyDeleteHelpers_(r.earlyDeleteHelpers_),
48  pathContext_(r.pathContext_) {
49 
50  for (auto& workerInPath : workers_) {
51  workerInPath.setPathContext(&pathContext_);
52  }
53  }
std::vector< EarlyDeleteHelper * > earlyDeleteHelpers_
Definition: Path.h:102
int timesFailed_
Definition: Path.h:91
int timesExcept_
Definition: Path.h:92
PathContext pathContext_
Definition: Path.h:104
std::shared_ptr< ActivityRegistry > actReg_
Definition: Path.h:98
TrigResPtr trptr_
Definition: Path.h:97
int bitpos_
Definition: Path.h:96
WorkersInPath workers_
Definition: Path.h:101
ExceptionToActionTable const * act_table_
Definition: Path.h:99
State state_
Definition: Path.h:94
int timesPassed_
Definition: Path.h:90
int timesRun_
Definition: Path.h:89

Member Function Documentation

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

Definition at line 62 of file Path.h.

References bitpos_.

Referenced by edm::fillPathSummary().

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

Definition at line 158 of file Path.cc.

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

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

158  {
159  using std::placeholders::_1;
161  for_all(workers_, std::bind(&WorkerInPath::clearCounters, _1));
162  }
int timesFailed_
Definition: Path.h:91
int timesExcept_
Definition: Path.h:92
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
WorkersInPath workers_
Definition: Path.h:101
int timesPassed_
Definition: Path.h:90
int timesRun_
Definition: Path.h:89
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 101 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().

107  {
108  std::ostringstream ost;
109  if (isEvent) {
110  ost << "Calling event method";
111  }
112  else if (begin && branchType == InRun) {
113  ost << "Calling beginRun";
114  }
115  else if (begin && branchType == InLumi) {
116  ost << "Calling beginLuminosityBlock";
117  }
118  else if (!begin && branchType == InLumi) {
119  ost << "Calling endLuminosityBlock";
120  }
121  else if (!begin && branchType == InRun) {
122  ost << "Calling endRun";
123  }
124  else {
125  // It should be impossible to get here ...
126  ost << "Calling unknown function";
127  }
128  ost << " for module " << desc.moduleName() << "/'" << desc.moduleLabel() << "'";
129  ex.addContext(ost.str());
130  ost.str("");
131  ost << "Running path '" << pathContext.pathName() << "'";
132  ex.addContext(ost.str());
133  ost.str("");
134  ost << "Processing ";
135  ost << id;
136  ex.addContext(ost.str());
137  }
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 79 of file Path.h.

References workers_.

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

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

Definition at line 182 of file Path.cc.

References earlyDeleteHelpers_.

Referenced by processOneOccurrence().

182  {
183  for(auto helper: earlyDeleteHelpers_) {
184  helper->pathFinished(iEvent);
185  }
186  }
std::vector< EarlyDeleteHelper * > earlyDeleteHelpers_
Definition: Path.h:102
int iEvent
Definition: GenABIO.cc:230
void edm::Path::handleEarlyFinish ( RunPrincipal const &  )
inlineprivate

Definition at line 126 of file Path.h.

126 {}
void edm::Path::handleEarlyFinish ( LuminosityBlockPrincipal const &  )
inlineprivate

Definition at line 127 of file Path.h.

127 {}
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 57 of file Path.cc.

References act_table_, mps_fire::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().

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

Definition at line 154 of file Path.h.

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

155  {
156 
157  int nwrwue = -1;
158  PathSignalSentry<T> signaler(actReg_.get(), nwrwue, state_, &pathContext_);
159 
160  if (T::isEvent_) {
161  ++timesRun_;
162  }
163  state_ = hlt::Ready;
164 
165  // nwrue = numWorkersRunWithoutUnhandledException
166  bool should_continue = true;
167 
168  for (WorkersInPath::iterator i = workers_.begin(), end = workers_.end();
169  i != end && should_continue;
170  ++i) {
171  ++nwrwue;
172  try {
173  convertException::wrap([&]() {
174  if(T::isEvent_) {
175  should_continue = i->runWorker<T>(ep, es, streamID, context);
176  } else {
177  should_continue = i->runWorker<T>(ep, es, streamID, context);
178  }
179  });
180  }
181  catch(cms::Exception& ex) {
182  // handleWorkerFailure may throw a new exception.
183  std::ostringstream ost;
184  ost << ep.id();
185  should_continue = handleWorkerFailure(ex, nwrwue, T::isEvent_, T::begin_, T::branchType_,
186  i->getWorker()->description(), ost.str());
187  }
188  }
189  if (not should_continue) {
190  handleEarlyFinish(ep);
191  }
192  updateCounters(should_continue, T::isEvent_);
193  recordStatus(nwrwue, T::isEvent_);
194  }
int i
Definition: DBlmapReader.cc:9
void recordStatus(int nwrwue, bool isEvent)
Definition: Path.cc:140
void handleEarlyFinish(EventPrincipal const &)
Definition: Path.cc:182
not [yet] run
Definition: HLTenums.h:18
PathContext pathContext_
Definition: Path.h:104
std::shared_ptr< ActivityRegistry > actReg_
Definition: Path.h:98
#define end
Definition: vmac.h:37
WorkersInPath workers_
Definition: Path.h:101
void updateCounters(bool succeed, bool isEvent)
Definition: Path.cc:147
bool handleWorkerFailure(cms::Exception &e, int nwrwue, bool isEvent, bool begin, BranchType branchType, ModuleDescription const &, std::string const &id)
Definition: Path.cc:57
State state_
Definition: Path.h:94
auto wrap(F iFunc) -> decltype(iFunc())
long double T
int timesRun_
Definition: Path.h:89
void edm::Path::recordStatus ( int  nwrwue,
bool  isEvent 
)
private

Definition at line 140 of file Path.cc.

References bitpos_, state_, and trptr_.

Referenced by handleWorkerFailure(), and processOneOccurrence().

140  {
141  if(isEvent && trptr_) {
142  (*trptr_)[bitpos_]=HLTPathStatus(state_, nwrwue);
143  }
144  }
TrigResPtr trptr_
Definition: Path.h:97
int bitpos_
Definition: Path.h:96
State state_
Definition: Path.h:94
void edm::Path::setEarlyDeleteHelpers ( std::map< const Worker *, EarlyDeleteHelper * > const &  iWorkerToDeleter)

Definition at line 165 of file Path.cc.

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

165  {
166  //we use a temp so we can overset the size but then when moving to earlyDeleteHelpers we only
167  // have to use the space necessary
168  std::vector<EarlyDeleteHelper*> temp;
169  temp.reserve(iWorkerToDeleter.size());
170  for(unsigned int index=0; index !=size();++index) {
171  auto found = iWorkerToDeleter.find(getWorker(index));
172  if(found != iWorkerToDeleter.end()) {
173  temp.push_back(found->second);
174  found->second->addedToPath();
175  }
176  }
177  std::vector<EarlyDeleteHelper*> tempCorrectSize(temp.begin(),temp.end());
178  earlyDeleteHelpers_.swap(tempCorrectSize);
179  }
std::vector< EarlyDeleteHelper * > earlyDeleteHelpers_
Definition: Path.h:102
size_type size() const
Definition: Path.h:74
Worker const * getWorker(size_type i) const
Definition: Path.h:79
size_type edm::Path::size ( void  ) const
inline

Definition at line 74 of file Path.h.

References workers_.

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

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

Definition at line 72 of file Path.h.

References state_.

72 { return state_; }
State state_
Definition: Path.h:94
int edm::Path::timesExcept ( ) const
inline

Definition at line 70 of file Path.h.

References timesExcept_.

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

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

Definition at line 78 of file Path.h.

References workers_.

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

Definition at line 69 of file Path.h.

References timesFailed_.

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

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

Definition at line 77 of file Path.h.

References workers_.

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

Definition at line 68 of file Path.h.

References timesPassed_.

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

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

Definition at line 76 of file Path.h.

References workers_.

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

Definition at line 67 of file Path.h.

References timesRun_.

Referenced by edm::fillPathSummary().

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

Definition at line 75 of file Path.h.

References workers_.

Referenced by edm::fillModuleInPathSummary().

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

Definition at line 147 of file Path.cc.

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

Referenced by processOneOccurrence().

147  {
148  if (success) {
149  if (isEvent) ++timesPassed_;
150  state_ = hlt::Pass;
151  } else {
152  if(isEvent) ++timesFailed_;
153  state_ = hlt::Fail;
154  }
155  }
int timesFailed_
Definition: Path.h:91
reject
Definition: HLTenums.h:20
accept
Definition: HLTenums.h:19
State state_
Definition: Path.h:94
int timesPassed_
Definition: Path.h:90

Member Data Documentation

ExceptionToActionTable const* edm::Path::act_table_
private

Definition at line 99 of file Path.h.

Referenced by handleWorkerFailure().

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

Definition at line 98 of file Path.h.

Referenced by processOneOccurrence().

int edm::Path::bitpos_
private

Definition at line 96 of file Path.h.

Referenced by bitPosition(), and recordStatus().

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

Definition at line 102 of file Path.h.

Referenced by handleEarlyFinish(), and setEarlyDeleteHelpers().

PathContext edm::Path::pathContext_
private

Definition at line 104 of file Path.h.

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

State edm::Path::state_
private

Definition at line 94 of file Path.h.

Referenced by handleWorkerFailure(), processOneOccurrence(), recordStatus(), state(), and updateCounters().

int edm::Path::timesExcept_
private

Definition at line 92 of file Path.h.

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

int edm::Path::timesFailed_
private

Definition at line 91 of file Path.h.

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

int edm::Path::timesPassed_
private

Definition at line 90 of file Path.h.

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

int edm::Path::timesRun_
private

Definition at line 89 of file Path.h.

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

TrigResPtr edm::Path::trptr_
private

Definition at line 97 of file Path.h.

Referenced by recordStatus().

WorkersInPath edm::Path::workers_
private