LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
WorkerInPath.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_WorkerInPath_h
2 #define art_Framework_Core_WorkerInPath_h
3 // vim: set sw=2 expandtab :
4 
5 // ====================================================================
6 // The WorkerInPath is a wrapper around a Worker, so that statistics
7 // can be managed per path. A Path holds Workers as these things.
8 //
9 // For a given module label, there will be n*m WorkerInPath objects,
10 // where n is the number of configured schedules, and m is the number
11 // paths in which the module label appears.
12 // ====================================================================
13 
15 #include "art/Framework/Core/fwd.h"
19 #include "art/Utilities/fwd.h"
20 #include "cetlib/exempt_ptr.h"
21 #include "hep_concurrency/WaitingTask.h"
22 
23 #include <string>
24 
25 namespace art {
26  using module_label_t = std::string;
27 
28  namespace detail {
29  struct ModuleConfigInfo;
30  }
31 
32  class WorkerInPath {
33  public:
34  struct ConfigInfo {
35  ConfigInfo(cet::exempt_ptr<detail::ModuleConfigInfo const> const info,
36  detail::FilterAction const action)
37  : moduleConfigInfo{info}, filterAction{action}
38  {}
39  cet::exempt_ptr<detail::ModuleConfigInfo const> moduleConfigInfo;
41  };
42 
43  // Special Member Functions
44  WorkerInPath(cet::exempt_ptr<Worker>,
46  PathContext const&,
47  GlobalTaskGroup& group);
48 
49  // API for user
50  Worker* getWorker() const;
51  detail::FilterAction filterAction() const;
52 
53  // Used only by Path
54  bool returnCode() const;
55  bool run(Transition, Principal&);
56  void run(hep::concurrency::WaitingTaskPtr workerDoneTask, EventPrincipal&);
57  void clearCounters();
58 
59  // Used by writeSummary
60  std::size_t timesVisited() const;
61  std::size_t timesPassed() const;
62  std::size_t timesFailed() const;
63  std::size_t timesExcept() const;
64 
65  private:
67 
68  cet::exempt_ptr<Worker> worker_;
72 
73  // Per-schedule
74  bool returnCode_{false};
75 
76  // Counts
77  std::size_t counts_visited_{};
78  std::size_t counts_passed_{};
79  std::size_t counts_failed_{};
80  std::size_t counts_thrown_{};
81  };
82 
83 } // namespace art
84 
85 #endif /* art_Framework_Core_WorkerInPath_h */
86 
87 // Local Variables:
88 // mode: c++
89 // End:
ConfigInfo(cet::exempt_ptr< detail::ModuleConfigInfo const > const info, detail::FilterAction const action)
Definition: WorkerInPath.h:35
ModuleContext moduleContext_
Definition: WorkerInPath.h:70
std::string module_label_t
Definition: WorkerInPath.h:26
detail::FilterAction filterAction
Definition: WorkerInPath.h:40
GlobalTaskGroup * taskGroup_
Definition: WorkerInPath.h:71
Transition
Definition: Transition.h:7
cet::exempt_ptr< detail::ModuleConfigInfo const > moduleConfigInfo
Definition: WorkerInPath.h:39
detail::FilterAction filterAction_
Definition: WorkerInPath.h:69
Definition: MVAAlg.h:12
cet::exempt_ptr< Worker > worker_
Definition: WorkerInPath.h:66