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 
18 
19 #include <memory>
20 
21 #include <set>
22 #include <string>
23 #include <vector>
24 
25 namespace edm {
26  class EventTransitionInfo;
27  class ExceptionCollector;
28  class StreamID;
29  class StreamContext;
30  class ModuleRegistry;
31  class PreallocationConfiguration;
32  namespace eventsetup {
34  }
35  class WorkerManager {
36  public:
37  typedef std::vector<Worker*> AllWorkers;
38 
39  WorkerManager(std::shared_ptr<ActivityRegistry> actReg, ExceptionToActionTable const& actions);
40  WorkerManager(WorkerManager&&) = default;
41 
42  WorkerManager(std::shared_ptr<ModuleRegistry> modReg,
43  std::shared_ptr<ActivityRegistry> actReg,
45 
47 
49  ProductRegistry& preg,
50  PreallocationConfiguration const* prealloc,
51  std::shared_ptr<ProcessConfiguration> processConfiguration,
53  std::set<std::string>& unscheduledLabels,
54  std::vector<std::string>& shouldBeUsedLabels);
55 
56  template <typename T, typename U>
58  typename T::TransitionInfoType&,
59  ServiceToken const&,
60  StreamID,
61  typename T::Context const* topContext,
62  U const* context);
63 
64  template <typename T>
66  typename T::TransitionInfoType const&,
67  ServiceToken const&,
68  StreamID,
69  ParentContext const&,
70  typename T::Context const*);
71 
72  void setupResolvers(Principal& principal);
74 
75  void beginJob(ProductRegistry const& iRegistry, eventsetup::ESRecordsToProxyIndices const&);
76  void endJob();
77  void endJob(ExceptionCollector& collector);
78 
79  void beginStream(StreamID iID, StreamContext& streamContext);
80  void endStream(StreamID iID, StreamContext& streamContext);
81 
82  AllWorkers const& allWorkers() const { return allWorkers_; }
83 
84  void addToAllWorkers(Worker* w);
85 
86  ExceptionToActionTable const& actionTable() const { return *actionTable_; }
87 
89  ProductRegistry& preg,
90  PreallocationConfiguration const* prealloc,
91  std::shared_ptr<ProcessConfiguration const> processConfiguration,
92  std::string const& label);
93 
94  void resetAll();
95 
96  private:
102  };
103 
104  template <typename T, typename U>
106  typename T::TransitionInfoType& info,
107  ServiceToken const& token,
108  StreamID streamID,
109  typename T::Context const* topContext,
110  U const* context) {
111  //make sure the unscheduled items see this run or lumi transition
112  unscheduled_.runNowAsync<T, U>(std::move(task), info, token, streamID, topContext, context);
113  }
114 
115  template <typename T>
117  typename T::TransitionInfoType const& info,
118  ServiceToken const& token,
119  StreamID streamID,
120  ParentContext const& parentContext,
121  typename T::Context const* context) {
122  unscheduled_.runAccumulatorsAsync<T>(std::move(task), info, token, streamID, parentContext, context);
123  }
124 } // namespace edm
125 
126 #endif
edm::EventTransitionInfo
Definition: TransitionInfoTypes.h:26
edm::StreamID
Definition: StreamID.h:30
edm::WorkerManager::addToAllWorkers
void addToAllWorkers(Worker *w)
Definition: WorkerManager.cc:133
edm::WorkerManager::AllWorkers
std::vector< Worker * > AllWorkers
Definition: WorkerManager.h:37
edm::UnscheduledCallProducer
Definition: UnscheduledCallProducer.h:38
ServiceRegistry.h
edm::eventsetup::ESRecordsToProxyIndices
Definition: ESRecordsToProxyIndices.h:35
WaitingTaskHolder.h
edm::WorkerManager::resetAll
void resetAll()
Definition: WorkerManager.cc:131
edm
HLT enums.
Definition: AlignableModifier.h:19
UnscheduledCallProducer.h
edm::WorkerManager::addToUnscheduledWorkers
void addToUnscheduledWorkers(ParameterSet &pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration > processConfiguration, std::string label, std::set< std::string > &unscheduledLabels, std::vector< std::string > &shouldBeUsedLabels)
Definition: WorkerManager.cc:52
edm::UnscheduledCallProducer::runAccumulatorsAsync
void runAccumulatorsAsync(WaitingTaskHolder task, typename T::TransitionInfoType const &info, ServiceToken const &token, StreamID streamID, ParentContext const &parentContext, typename T::Context const *context)
Definition: UnscheduledCallProducer.h:92
edm::Principal
Definition: Principal.h:56
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
edm::WorkerManager::actionTable
ExceptionToActionTable const & actionTable() const
Definition: WorkerManager.h:86
edm::ProductRegistry
Definition: ProductRegistry.h:37
edm::ServiceToken
Definition: ServiceToken.h:42
edm::StreamContext
Definition: StreamContext.h:31
edm::ExceptionCollector
Definition: ExceptionCollector.h:33
w
const double w
Definition: UKUtility.cc:23
edm::WorkerManager::unscheduled_
UnscheduledCallProducer unscheduled_
Definition: WorkerManager.h:100
TrackValidation_cff.task
task
Definition: TrackValidation_cff.py:252
edm::WorkerManager::allWorkers
AllWorkers const & allWorkers() const
Definition: WorkerManager.h:82
ConvertException.h
edm::Worker
Definition: Worker.h:90
edm::WorkerManager::actionTable_
ExceptionToActionTable const * actionTable_
Definition: WorkerManager.h:98
edm::WorkerManager::workerReg_
WorkerRegistry workerReg_
Definition: WorkerManager.h:97
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::WorkerManager::beginJob
void beginJob(ProductRegistry const &iRegistry, eventsetup::ESRecordsToProxyIndices const &)
Definition: WorkerManager.cc:91
edm::ParentContext
Definition: ParentContext.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::WorkerManager::beginStream
void beginStream(StreamID iID, StreamContext &streamContext)
Definition: WorkerManager.cc:119
edm::ParameterSet
Definition: ParameterSet.h:47
edm::WaitingTaskHolder
Definition: WaitingTaskHolder.h:32
edm::WorkerManager::setupOnDemandSystem
void setupOnDemandSystem(EventTransitionInfo const &)
Definition: WorkerManager.cc:148
ESRecordsToProxyIndices
edm::WorkerManager::allWorkers_
AllWorkers allWorkers_
Definition: WorkerManager.h:99
edm::WorkerManager::processAccumulatorsAsync
void processAccumulatorsAsync(WaitingTaskHolder, typename T::TransitionInfoType const &, ServiceToken const &, StreamID, ParentContext const &, typename T::Context const *)
Definition: WorkerManager.h:116
edm::ExceptionToActionTable
Definition: ExceptionActions.h:16
edm::UnscheduledCallProducer::runNowAsync
void runNowAsync(WaitingTaskHolder task, typename T::TransitionInfoType const &info, ServiceToken const &token, StreamID streamID, typename T::Context const *topContext, U const *context) const
Definition: UnscheduledCallProducer.h:70
edm::WorkerRegistry
The Registry of all workers that where requested Holds all instances of workers. In this implementati...
Definition: WorkerRegistry.h:38
edm::PreallocationConfiguration
Definition: PreallocationConfiguration.h:27
eostools.move
def move(src, dest)
Definition: eostools.py:511
ExceptionHelpers.h
Frameworkfwd.h
T
long double T
Definition: Basic3DVectorLD.h:48
Worker.h
WorkerRegistry.h
Exception.h
edm::WorkerManager::setupResolvers
void setupResolvers(Principal &principal)
Definition: WorkerManager.cc:139
edm::WorkerManager::endStream
void endStream(StreamID iID, StreamContext &streamContext)
Definition: WorkerManager.cc:125
edm::WorkerManager::getWorker
Worker * getWorker(ParameterSet &pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, std::string const &label)
Definition: WorkerManager.cc:43
edm::WorkerManager::processOneOccurrenceAsync
void processOneOccurrenceAsync(WaitingTaskHolder, typename T::TransitionInfoType &, ServiceToken const &, StreamID, typename T::Context const *topContext, U const *context)
Definition: WorkerManager.h:105
actions
roAction_t actions[nactions]
Definition: GenABIO.cc:181
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4
get_underlying_safe.h
edm::WorkerManager::deleteModuleIfExists
void deleteModuleIfExists(std::string const &moduleLabel)
Definition: WorkerManager.cc:33
edm::WorkerManager
Definition: WorkerManager.h:35
label
const char * label
Definition: PFTauDecayModeTools.cc:11
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::WorkerManager::WorkerManager
WorkerManager(std::shared_ptr< ActivityRegistry > actReg, ExceptionToActionTable const &actions)
Definition: WorkerManager.cc:17
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316
edm::WorkerManager::lastSetupEventPrincipal_
void const * lastSetupEventPrincipal_
Definition: WorkerManager.h:101
edm::WorkerManager::endJob
void endJob()
Definition: WorkerManager.cc:75