LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::TriggerPathsExecutor Class Reference

#include "TriggerPathsExecutor.h"

Classes

class  PathsDoneTask
 

Public Member Functions

 TriggerPathsExecutor (ScheduleID, PathManager &, ActionTable const &, ActivityRegistry const &activityRegistry, GlobalTaskGroup &group)
 
 TriggerPathsExecutor (TriggerPathsExecutor const &)=delete
 
 TriggerPathsExecutor (TriggerPathsExecutor &&)=delete
 
TriggerPathsExecutoroperator= (TriggerPathsExecutor const &)=delete
 
TriggerPathsExecutoroperator= (TriggerPathsExecutor &&)=delete
 
void process (Transition, Principal &)
 
void process_event (hep::concurrency::WaitingTaskPtr endPathTask, EventPrincipal &)
 
void beginJob (detail::SharedResources const &resources)
 
void endJob ()
 
void respondToOpenInputFile (FileBlock const &)
 
void respondToCloseInputFile (FileBlock const &)
 
void respondToOpenOutputFiles (FileBlock const &)
 
void respondToCloseOutputFiles (FileBlock const &)
 
void process_event_paths_done (EventPrincipal &)
 

Private Member Functions

bool skipNonReplicated_ (Worker const &)
 

Private Attributes

ScheduleContext const sc_
 
ActionTable const & actionTable_
 
ActivityRegistry const & actReg_
 
PathsInfotriggerPathsInfo_
 
std::unique_ptr< Workerresults_inserter_
 
GlobalTaskGrouptaskGroup_
 

Detailed Description

Definition at line 43 of file TriggerPathsExecutor.h.

Constructor & Destructor Documentation

art::TriggerPathsExecutor::TriggerPathsExecutor ( ScheduleID  scheduleID,
PathManager pm,
ActionTable const &  actions,
ActivityRegistry const &  activityRegistry,
GlobalTaskGroup group 
)

Definition at line 40 of file TriggerPathsExecutor.cc.

References actionTable_, actReg_, results_inserter_, taskGroup_, TDEBUG_FUNC_SI, and triggerPathsInfo_.

46  : sc_{scheduleID}
47  , actionTable_{actions}
48  , actReg_{activityRegistry}
49  , triggerPathsInfo_{pm.triggerPathsInfo(scheduleID)}
50  , results_inserter_{pm.releaseTriggerResultsInserter(scheduleID)}
51  , taskGroup_{group}
52  {
53  TDEBUG_FUNC_SI(5, scheduleID) << hex << this << dec;
54  }
ScheduleContext const sc_
std::unique_ptr< Worker > results_inserter_
ActivityRegistry const & actReg_
ActionTable const & actionTable_
#define TDEBUG_FUNC_SI(LEVEL, SI)
art::TriggerPathsExecutor::TriggerPathsExecutor ( TriggerPathsExecutor const &  )
delete
art::TriggerPathsExecutor::TriggerPathsExecutor ( TriggerPathsExecutor &&  )
delete

Member Function Documentation

void art::TriggerPathsExecutor::beginJob ( detail::SharedResources const &  resources)

Definition at line 57 of file TriggerPathsExecutor.cc.

References results_inserter_, and triggerPathsInfo_.

Referenced by art::Schedule::beginJob().

58  {
59  for (auto& worker : unique_workers(triggerPathsInfo_)) {
60  worker.beginJob(resources);
61  }
62  if (results_inserter_) {
63  results_inserter_->beginJob(resources);
64  }
65  }
std::unique_ptr< Worker > results_inserter_
void art::TriggerPathsExecutor::endJob ( )

Definition at line 68 of file TriggerPathsExecutor.cc.

References e, art::errors::EndJobFailure, results_inserter_, and triggerPathsInfo_.

Referenced by art::Schedule::endJob().

69  {
71  for (auto& worker : unique_workers(triggerPathsInfo_)) {
72  // FIXME: The catch and rethrow here seems to have little value added.
73  try {
74  worker.endJob();
75  }
76  catch (cet::exception& e) {
77  error << "cet::exception caught in TriggerPathsExecutor::endJob\n"
78  << e.explain_self();
79  throw error;
80  }
81  catch (exception& e) {
82  error << "Standard library exception caught in "
83  "TriggerPathsExecutor::endJob\n"
84  << e.what();
85  throw error;
86  }
87  catch (...) {
88  error << "Unknown exception caught in TriggerPathsExecutor::endJob\n";
89  throw error;
90  }
91  }
92  if (results_inserter_) {
93  // FIXME: The catch and rethrow here seems to have little value added.
94  try {
95  results_inserter_->endJob();
96  }
97  catch (cet::exception& e) {
98  error << "cet::exception caught in TriggerPathsExecutor::endJob\n"
99  << e.explain_self();
100  throw error;
101  }
102  catch (exception& e) {
103  error << "Standard library exception caught in "
104  "TriggerPathsExecutor::endJob\n"
105  << e.what();
106  throw error;
107  }
108  catch (...) {
109  error << "Unknown exception caught in TriggerPathsExecutor::endJob\n";
110  throw error;
111  }
112  }
113  }
std::unique_ptr< Worker > results_inserter_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Float_t e
Definition: plot.C:35
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
TriggerPathsExecutor& art::TriggerPathsExecutor::operator= ( TriggerPathsExecutor const &  )
delete
TriggerPathsExecutor& art::TriggerPathsExecutor::operator= ( TriggerPathsExecutor &&  )
delete
void art::TriggerPathsExecutor::process ( Transition  trans,
Principal principal 
)

Definition at line 160 of file TriggerPathsExecutor.cc.

References art::PathsInfo::paths(), art::PathsInfo::reset(), and triggerPathsInfo_.

Referenced by art::Schedule::process().

161  {
163  for (auto& path : triggerPathsInfo_.paths()) {
164  path.process(trans, principal);
165  }
166  }
std::vector< Path > & paths()
Definition: PathsInfo.cc:54
void reset()
Definition: PathsInfo.cc:77
void art::TriggerPathsExecutor::process_event ( hep::concurrency::WaitingTaskPtr  endPathTask,
EventPrincipal  
)

Definition at line 213 of file TriggerPathsExecutor.cc.

References actReg_, art::ScheduleContext::id(), art::PathsInfo::incrementTotalEventCount(), art::ModuleContext::invalid(), art::EventPrincipal::makeEvent(), art::GlobalTaskGroup::may_run(), art::PathsInfo::paths(), art::PathsInfo::reset_for_event(), results_inserter_, sc_, art::ActivityRegistry::sPreProcessEvent, taskGroup_, TDEBUG_BEGIN_FUNC_SI, TDEBUG_END_FUNC_SI, and triggerPathsInfo_.

Referenced by art::Schedule::process_event_modifiers().

215  {
216  // We get here as part of the readAndProcessEventTask (schedule
217  // head task).
218  actReg_.sPreProcessEvent.invoke(
219  event_principal.makeEvent(ModuleContext::invalid()), sc_);
220  auto const scheduleID = sc_.id();
221  TDEBUG_BEGIN_FUNC_SI(4, scheduleID);
222  if (results_inserter_) {
223  results_inserter_->reset();
224  }
227  try {
228  if (triggerPathsInfo_.paths().empty()) {
229  auto pathsDoneTask = make_waiting_task<PathsDoneTask>(
230  this, endPathTask, event_principal, taskGroup_);
231  taskGroup_.may_run(pathsDoneTask);
232  TDEBUG_END_FUNC_SI(4, scheduleID);
233  return;
234  }
235  auto pathsDoneTask = std::make_shared<WaitingTask>(
236  PathsDoneTask{this, endPathTask, event_principal, taskGroup_},
237  triggerPathsInfo_.paths().size());
238  for (auto& path : triggerPathsInfo_.paths()) {
239  // Start each path running. The path will start a spawn chain
240  // going to run each worker in the order specified on the
241  // path, and when they have all been run, it will call
242  // doneWaiting() on the pathsDoneTask, which decrements its
243  // reference count, which will eventually cause it to run when
244  // every path has finished.
245  path.process(pathsDoneTask, event_principal);
246  }
247  TDEBUG_END_FUNC_SI(4, scheduleID);
248  }
249  catch (...) {
250  taskGroup_.may_run(endPathTask, current_exception());
251  TDEBUG_END_FUNC_SI(4, scheduleID) << "because of EXCEPTION";
252  }
253  }
ScheduleContext const sc_
std::unique_ptr< Worker > results_inserter_
std::vector< Path > & paths()
Definition: PathsInfo.cc:54
ActivityRegistry const & actReg_
GlobalSignal< detail::SignalResponseType::FIFO, void(Event const &, ScheduleContext)> sPreProcessEvent
void reset_for_event()
Definition: PathsInfo.cc:85
#define TDEBUG_END_FUNC_SI(LEVEL, SI)
void may_run(hep::concurrency::WaitingTaskPtr task, std::exception_ptr ex_ptr={})
#define TDEBUG_BEGIN_FUNC_SI(LEVEL, SI)
static ModuleContext invalid()
Definition: ModuleContext.h:22
void incrementTotalEventCount()
Definition: PathsInfo.cc:98
void art::TriggerPathsExecutor::process_event_paths_done ( EventPrincipal principal)

Definition at line 256 of file TriggerPathsExecutor.cc.

References art::HLTGlobalStatus::accept(), actionTable_, art::PathContext::art_path_spec(), e, art::actions::FailModule, art::actions::FailPath, art::ActionTable::find(), art::ScheduleContext::id(), art::actions::IgnoreCompletely, art::PathsInfo::incrementPassedEventCount(), art::PathsInfo::pathResults(), results_inserter_, sc_, art::actions::SkipEvent, TDEBUG_BEGIN_FUNC_SI, TDEBUG_END_FUNC_SI, and triggerPathsInfo_.

257  {
258  // We come here as part of the pathsDoneTask.
259  auto const scheduleID = sc_.id();
260  TDEBUG_BEGIN_FUNC_SI(4, scheduleID);
261  try {
264  }
265  if (results_inserter_) {
266  // FIXME: not sure what the trigger bit should be
267  auto const& resultsInserterDesc = results_inserter_->description();
268  PathContext const pc{sc_,
270  {resultsInserterDesc.moduleLabel()}};
271  ModuleContext const mc{pc, resultsInserterDesc};
272  results_inserter_->doWork_event(principal, mc);
273  }
274  }
275  catch (cet::exception& e) {
276  auto action = actionTable_.find(e.root_cause());
277  assert(action != actions::IgnoreCompletely);
278  assert(action != actions::FailPath);
279  assert(action != actions::FailModule);
280  if (action != actions::SkipEvent) {
281  TDEBUG_END_FUNC_SI(4, scheduleID);
282  throw;
283  }
284  mf::LogWarning(e.category())
285  << "An exception occurred inserting the TriggerResults object:\n"
286  << cet::trim_right_copy(e.what(), " \n");
287  }
288  TDEBUG_END_FUNC_SI(4, scheduleID);
289  }
ScheduleContext const sc_
std::unique_ptr< Worker > results_inserter_
HLTGlobalStatus & pathResults()
Definition: PathsInfo.cc:92
actions::ActionCodes find(std::string const &category) const
Definition: Actions.cc:58
ActionTable const & actionTable_
#define TDEBUG_END_FUNC_SI(LEVEL, SI)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void incrementPassedEventCount()
Definition: PathsInfo.cc:104
#define TDEBUG_BEGIN_FUNC_SI(LEVEL, SI)
static auto art_path_spec()
Definition: PathContext.h:32
Float_t e
Definition: plot.C:35
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void art::TriggerPathsExecutor::respondToCloseInputFile ( FileBlock const &  fb)

Definition at line 127 of file TriggerPathsExecutor.cc.

References results_inserter_, and triggerPathsInfo_.

Referenced by art::Schedule::respondToCloseInputFile().

128  {
129  for (auto& worker : unique_workers(triggerPathsInfo_)) {
130  worker.respondToCloseInputFile(fb);
131  }
132  if (results_inserter_) {
133  results_inserter_->respondToCloseInputFile(fb);
134  }
135  }
std::unique_ptr< Worker > results_inserter_
TFile fb("Li6.root")
void art::TriggerPathsExecutor::respondToCloseOutputFiles ( FileBlock const &  fb)

Definition at line 149 of file TriggerPathsExecutor.cc.

References results_inserter_, and triggerPathsInfo_.

Referenced by art::Schedule::respondToCloseOutputFiles().

150  {
151  for (auto& worker : unique_workers(triggerPathsInfo_)) {
152  worker.respondToCloseOutputFiles(fb);
153  }
154  if (results_inserter_) {
155  results_inserter_->respondToCloseOutputFiles(fb);
156  }
157  }
std::unique_ptr< Worker > results_inserter_
TFile fb("Li6.root")
void art::TriggerPathsExecutor::respondToOpenInputFile ( FileBlock const &  fb)

Definition at line 116 of file TriggerPathsExecutor.cc.

References results_inserter_, and triggerPathsInfo_.

Referenced by art::Schedule::respondToOpenInputFile().

117  {
118  for (auto& worker : unique_workers(triggerPathsInfo_)) {
119  worker.respondToOpenInputFile(fb);
120  }
121  if (results_inserter_) {
122  results_inserter_->respondToOpenInputFile(fb);
123  }
124  }
std::unique_ptr< Worker > results_inserter_
TFile fb("Li6.root")
void art::TriggerPathsExecutor::respondToOpenOutputFiles ( FileBlock const &  fb)

Definition at line 138 of file TriggerPathsExecutor.cc.

References results_inserter_, and triggerPathsInfo_.

Referenced by art::Schedule::respondToOpenOutputFiles().

139  {
140  for (auto& worker : unique_workers(triggerPathsInfo_)) {
141  worker.respondToOpenOutputFiles(fb);
142  }
143  if (results_inserter_) {
144  results_inserter_->respondToOpenOutputFiles(fb);
145  }
146  }
std::unique_ptr< Worker > results_inserter_
TFile fb("Li6.root")
bool art::TriggerPathsExecutor::skipNonReplicated_ ( Worker const &  )
private

Member Data Documentation

ActionTable const& art::TriggerPathsExecutor::actionTable_
private

Definition at line 77 of file TriggerPathsExecutor.h.

Referenced by process_event_paths_done(), and TriggerPathsExecutor().

ActivityRegistry const& art::TriggerPathsExecutor::actReg_
private

Definition at line 78 of file TriggerPathsExecutor.h.

Referenced by process_event(), and TriggerPathsExecutor().

ScheduleContext const art::TriggerPathsExecutor::sc_
private

Definition at line 76 of file TriggerPathsExecutor.h.

Referenced by process_event(), and process_event_paths_done().


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