CMS 3D CMS Logo

WorkerManager.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_WorkerManager_h
2 #define FWCore_Framework_WorkerManager_h
3 
4 /*
5 
6 */
7 
19 
20 #include <memory>
21 
22 #include <set>
23 #include <string>
24 #include <vector>
25 
26 namespace edm {
27  class EventTransitionInfo;
28  class ExceptionCollector;
29  class StreamID;
30  class StreamContext;
31  class ModuleRegistry;
32  class ModuleTypeResolverMaker;
33  class PreallocationConfiguration;
34  namespace eventsetup {
36  }
37  class WorkerManager {
38  public:
39  typedef std::vector<Worker*> AllWorkers;
40 
41  WorkerManager(std::shared_ptr<ActivityRegistry> actReg,
43  ModuleTypeResolverMaker const* typeResolverMaker);
44  WorkerManager(WorkerManager&&) = default;
45 
46  WorkerManager(std::shared_ptr<ModuleRegistry> modReg,
47  std::shared_ptr<ActivityRegistry> actReg,
49 
51 
53  ProductRegistry& preg,
54  PreallocationConfiguration const* prealloc,
55  std::shared_ptr<ProcessConfiguration const> processConfiguration,
57  std::set<std::string>& unscheduledLabels,
58  std::vector<std::string>& shouldBeUsedLabels);
59 
60  template <typename T, typename U>
62  typename T::TransitionInfoType&,
63  ServiceToken const&,
64  StreamID,
65  typename T::Context const* topContext,
66  U const* context);
67 
68  template <typename T>
70  typename T::TransitionInfoType const&,
71  ServiceToken const&,
72  StreamID,
73  ParentContext const&,
74  typename T::Context const*);
75 
76  void setupResolvers(Principal& principal);
78 
79  void beginJob(ProductRegistry const& iRegistry,
81  ProcessBlockHelperBase const&);
82  void endJob();
83  void endJob(ExceptionCollector& collector);
84 
85  void beginStream(StreamID iID, StreamContext& streamContext);
86  void endStream(StreamID iID, StreamContext& streamContext);
87 
88  AllWorkers const& allWorkers() const { return allWorkers_; }
89  AllWorkers const& unscheduledWorkers() const { return unscheduled_.workers(); }
90 
91  void addToAllWorkers(Worker* w);
92 
93  ExceptionToActionTable const& actionTable() const { return *actionTable_; }
94 
96  ProductRegistry& preg,
97  PreallocationConfiguration const* prealloc,
98  std::shared_ptr<ProcessConfiguration const> processConfiguration,
99  std::string const& label);
100 
101  void resetAll();
102 
103  private:
109  };
110 
111  template <typename T, typename U>
113  typename T::TransitionInfoType& info,
114  ServiceToken const& token,
115  StreamID streamID,
116  typename T::Context const* topContext,
117  U const* context) {
118  //make sure the unscheduled items see this run or lumi transition
119  unscheduled_.runNowAsync<T, U>(std::move(task), info, token, streamID, topContext, context);
120  }
121 
122  template <typename T>
124  typename T::TransitionInfoType const& info,
125  ServiceToken const& token,
126  StreamID streamID,
127  ParentContext const& parentContext,
128  typename T::Context const* context) {
129  unscheduled_.runAccumulatorsAsync<T>(std::move(task), info, token, streamID, parentContext, context);
130  }
131 } // namespace edm
132 
133 #endif
static const TGPicture * info(bool iBackgroundIsBlack)
roAction_t actions[nactions]
Definition: GenABIO.cc:181
worker_container const & workers() const
void endStream(StreamID iID, StreamContext &streamContext)
void processAccumulatorsAsync(WaitingTaskHolder, typename T::TransitionInfoType const &, ServiceToken const &, StreamID, ParentContext const &, typename T::Context const *)
T w() const
void beginJob(ProductRegistry const &iRegistry, eventsetup::ESRecordsToProductResolverIndices const &, ProcessBlockHelperBase const &)
UnscheduledCallProducer unscheduled_
AllWorkers allWorkers_
void runNowAsync(WaitingTaskHolder task, typename T::TransitionInfoType const &info, ServiceToken const &token, StreamID streamID, typename T::Context const *topContext, U const *context) const
void setupOnDemandSystem(EventTransitionInfo const &)
AllWorkers const & unscheduledWorkers() const
Definition: WorkerManager.h:89
void deleteModuleIfExists(std::string const &moduleLabel)
ExceptionToActionTable const * actionTable_
Worker * getWorker(ParameterSet &pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, std::string const &label)
void const * lastSetupEventPrincipal_
void processOneOccurrenceAsync(WaitingTaskHolder, typename T::TransitionInfoType &, ServiceToken const &, StreamID, typename T::Context const *topContext, U const *context)
std::vector< Worker * > AllWorkers
Definition: WorkerManager.h:39
char const * label
WorkerManager(std::shared_ptr< ActivityRegistry > actReg, ExceptionToActionTable const &actions, ModuleTypeResolverMaker const *typeResolverMaker)
AllWorkers const & allWorkers() const
Definition: WorkerManager.h:88
ExceptionToActionTable const & actionTable() const
Definition: WorkerManager.h:93
void beginStream(StreamID iID, StreamContext &streamContext)
void addToUnscheduledWorkers(ParameterSet &pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, std::string label, std::set< std::string > &unscheduledLabels, std::vector< std::string > &shouldBeUsedLabels)
HLT enums.
void setupResolvers(Principal &principal)
WorkerRegistry workerReg_
The Registry of all workers that where requested Holds all instances of workers. In this implementati...
long double T
def move(src, dest)
Definition: eostools.py:511
void addToAllWorkers(Worker *w)
void runAccumulatorsAsync(WaitingTaskHolder task, typename T::TransitionInfoType const &info, ServiceToken const &token, StreamID streamID, ParentContext const &parentContext, typename T::Context const *context)