CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Path.cc
Go to the documentation of this file.
1 
6 
7 #include <algorithm>
8 #include "boost/bind.hpp"
9 
10 namespace edm {
11  Path::Path(int bitpos, std::string const& path_name,
12  WorkersInPath const& workers,
13  TrigResPtr trptr,
14  ActionTable const& actions,
15  boost::shared_ptr<ActivityRegistry> areg,
16  bool isEndPath):
17  stopwatch_(),
18  timesRun_(),
19  timesPassed_(),
20  timesFailed_(),
21  timesExcept_(),
22  state_(hlt::Ready),
23  bitpos_(bitpos),
24  name_(path_name),
25  trptr_(trptr),
26  actReg_(areg),
27  act_table_(&actions),
28  workers_(workers),
29  isEndPath_(isEndPath) {
30  }
31 
32  bool
34  int nwrwue, bool isEvent) {
35  bool should_continue = true;
36 
37  // there is no support as of yet for specific paths having
38  // different exception behavior
39 
40  // If not processing an event, always rethrow.
42  assert (action != actions::FailModule);
43  switch(action) {
44  case actions::FailPath: {
45  should_continue = false;
46  LogWarning(e.category())
47  << "Failing path " << name_
48  << ", due to exception, message:\n"
49  << e.what() << "\n";
50  break;
51  }
52  default: {
53  if (isEvent) ++timesExcept_;
55  recordStatus(nwrwue, isEvent);
56  if (action == actions::Rethrow) {
58  if (e.category() == pNF) {
59  e << "If you wish to continue processing events after a " << pNF << " exception,\n" <<
60  "add \"SkipEvent = cms.untracked.vstring('ProductNotFound')\" to the \"options\" PSet in the configuration.\n";
61  }
62  }
63  e << "ProcessingStopped\n";
64  e << "Exception going through path " << name_ << "\n";
65  throw;
66  }
67  }
68 
69  return should_continue;
70  }
71 
72  void
73  Path::recordUnknownException(int nwrwue, bool isEvent) {
74  LogError("PassingThrough")
75  << "Exception passing through path " << name_ << "\n";
76  if (isEvent) ++timesExcept_;
78  recordStatus(nwrwue, isEvent);
79  }
80 
81  void
82  Path::recordStatus(int nwrwue, bool isEvent) {
83  if(isEvent) {
84  (*trptr_)[bitpos_]=HLTPathStatus(state_, nwrwue);
85  }
86  }
87 
88  void
89  Path::updateCounters(bool success, bool isEvent) {
90  if (success) {
91  if (isEvent) ++timesPassed_;
92  state_ = hlt::Pass;
93  } else {
94  if(isEvent) ++timesFailed_;
95  state_ = hlt::Fail;
96  }
97  }
98 
99  void
102  for_all(workers_, boost::bind(&WorkerInPath::clearCounters, _1));
103  }
104 
105  void
107  stopwatch_.reset(new RunStopwatch::StopwatchPointer::element_type);
108  for(WorkersInPath::iterator it=workers_.begin(), itEnd = workers_.end();
109  it != itEnd;
110  ++it) {
111  it->useStopwatch();
112  }
113  }
114 
115 
116 }
virtual char const * what() const
Definition: Exception.cc:97
Path(int bitpos, std::string const &path_name, WorkersInPath const &workers, TrigResPtr trptr, ActionTable const &actions, boost::shared_ptr< ActivityRegistry > reg, bool isEndPath)
Definition: Path.cc:11
void recordStatus(int nwrwue, bool isEvent)
Definition: Path.cc:82
not [yet] run
Definition: HLTenums.h:21
roAction_t actions[nactions]
Definition: GenABIO.cc:200
std::string rootCause() const
Definition: Exception.cc:78
int timesFailed_
Definition: Path.h:82
std::vector< WorkerInPath > WorkersInPath
Definition: Path.h:33
bool handleWorkerFailure(cms::Exception const &e, int nwrwue, bool isEvent)
Definition: Path.cc:33
ActionTable const * act_table_
Definition: Path.h:91
reject
Definition: HLTenums.h:23
int timesExcept_
Definition: Path.h:83
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
std::string name_
Definition: Path.h:88
boost::shared_ptr< HLTGlobalStatus > TrigResPtr
Definition: Path.h:35
accept
Definition: HLTenums.h:22
int bitpos_
Definition: Path.h:87
static std::string codeToString(Code)
-----------— implementation details ---------------—
Definition: EDMException.cc:48
void recordUnknownException(int nwrwue, bool isEvent)
Definition: Path.cc:73
WorkersInPath workers_
Definition: Path.h:93
void updateCounters(bool succeed, bool isEvent)
Definition: Path.cc:89
void useStopwatch()
Definition: Path.cc:106
RunStopwatch::StopwatchPointer stopwatch_
Definition: Path.h:79
State state_
Definition: Path.h:85
actions::ActionCodes find(const std::string &category) const
Definition: Actions.cc:95
int timesPassed_
Definition: Path.h:81
int timesRun_
Definition: Path.h:80
void clearCounters()
Definition: Path.cc:100
std::string category() const
Definition: Exception.cc:74