CMS 3D CMS Logo

UnscheduledCallProducer.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_UnscheduledCallProducer_h
2 #define FWCore_Framework_UnscheduledCallProducer_h
3 
4 // -*- C++ -*-
5 //
6 // Package: FWCore/Framework
7 // Class : UnscheduledCallProducer
8 //
25 
26 #include <vector>
27 #include <unordered_map>
28 #include <string>
29 #include <sstream>
30 
31 namespace edm {
32 
33  class ModuleCallingContext;
34 
36  public:
37  using worker_container = std::vector<Worker*>;
38  using const_iterator = worker_container::const_iterator;
39 
43  }
44  void addWorker(Worker* aWorker) {
45  assert(nullptr != aWorker);
46  unscheduledWorkers_.push_back(aWorker);
47  if (aWorker->hasAccumulator()) {
48  accumulatorWorkers_.push_back(aWorker);
49  }
50  }
51 
52  void setEventSetup(EventSetupImpl const& iSetup) { aux_.setEventSetup(&iSetup); }
53 
54  UnscheduledAuxiliary const& auxiliary() const { return aux_; }
55 
56  const_iterator begin() const { return unscheduledWorkers_.begin(); }
57  const_iterator end() const { return unscheduledWorkers_.end(); }
58 
59  template <typename T, typename U>
61  typename T::MyPrincipal& p,
62  EventSetupImpl const& es,
63  ServiceToken const& token,
64  StreamID streamID,
65  typename T::Context const* topContext,
66  U const* context) const {
67  //do nothing for event since we will run when requested
68  if (!T::isEvent_) {
69  for (auto worker : unscheduledWorkers_) {
70  ParentContext parentContext(context);
71 
72  // We do not need to run prefetching here because this only handles
73  // stream transitions for runs and lumis. There are no products put
74  // into the runs or lumis in stream transitions, so there can be
75  // no data dependencies which require prefetching. Prefetching is
76  // needed for global transitions, but they are run elsewhere.
77  worker->doWorkNoPrefetchingAsync<T>(task, p, es, token, streamID, parentContext, topContext);
78  }
79  }
80  }
81 
82  template <typename T>
84  typename T::MyPrincipal const& ep,
85  EventSetupImpl const& es,
86  ServiceToken const& token,
87  StreamID streamID,
88  ParentContext const& parentContext,
89  typename T::Context const* context) {
90  for (auto worker : accumulatorWorkers_) {
91  worker->doWorkAsync<T>(task, ep, es, token, streamID, parentContext, context);
92  }
93  }
94 
95  private:
96  template <typename T, typename ID>
97  void addContextToException(cms::Exception& ex, Worker const* worker, ID const& id) const {
98  std::ostringstream ost;
99  ost << "Processing " << T::transitionName() << " " << id;
100  ex.addContext(ost.str());
101  }
105  };
106 
107 } // namespace edm
108 
109 #endif
edm::UnscheduledCallProducer::addContextToException
void addContextToException(cms::Exception &ex, Worker const *worker, ID const &id) const
Definition: UnscheduledCallProducer.h:97
edm::UnscheduledAuxiliary::setEventSetup
void setEventSetup(EventSetupImpl const *iSetup)
Definition: UnscheduledAuxiliary.h:43
edm::StreamID
Definition: StreamID.h:30
edm::UnscheduledCallProducer::UnscheduledCallProducer
UnscheduledCallProducer(ActivityRegistry &iReg)
Definition: UnscheduledCallProducer.h:40
edm::UnscheduledCallProducer
Definition: UnscheduledCallProducer.h:35
cms::Exception::addContext
void addContext(std::string const &context)
Definition: Exception.cc:165
edm::EventSetupImpl
Definition: EventSetupImpl.h:44
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
cms::cuda::assert
assert(be >=bs)
ActivityRegistry.h
BranchActionType.h
edm::ServiceToken
Definition: ServiceToken.h:40
edm::UnscheduledCallProducer::aux_
UnscheduledAuxiliary aux_
Definition: UnscheduledCallProducer.h:104
edm::UnscheduledCallProducer::const_iterator
worker_container::const_iterator const_iterator
Definition: UnscheduledCallProducer.h:38
TrackValidation_cff.task
task
Definition: TrackValidation_cff.py:252
edm::ActivityRegistry
Definition: ActivityRegistry.h:132
edm::Worker
Definition: Worker.h:83
edm::UnscheduledAuxiliary::preModuleDelayedGetSignal_
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> preModuleDelayedGetSignal_
Definition: UnscheduledAuxiliary.h:45
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::ParentContext
Definition: ParentContext.h:27
edm::ActivityRegistry::postModuleEventDelayedGetSignal_
PostModuleEventDelayedGet postModuleEventDelayedGetSignal_
Definition: ActivityRegistry.h:706
align::ID
uint32_t ID
Definition: Definitions.h:24
edm::UnscheduledCallProducer::addWorker
void addWorker(Worker *aWorker)
Definition: UnscheduledCallProducer.h:44
edm::UnscheduledCallProducer::setEventSetup
void setEventSetup(EventSetupImpl const &iSetup)
Definition: UnscheduledCallProducer.h:52
UnscheduledAuxiliary.h
edm::UnscheduledCallProducer::begin
const_iterator begin() const
Definition: UnscheduledCallProducer.h:56
edm::ActivityRegistry::preModuleEventDelayedGetSignal_
PreModuleEventDelayedGet preModuleEventDelayedGetSignal_
Definition: ActivityRegistry.h:698
edm::UnscheduledAuxiliary
Definition: UnscheduledAuxiliary.h:33
edm::UnscheduledCallProducer::worker_container
std::vector< Worker * > worker_container
Definition: UnscheduledCallProducer.h:37
OccurrenceTraits.h
ParentContext.h
edm::WaitingTask
Definition: WaitingTask.h:36
edm::UnscheduledCallProducer::auxiliary
UnscheduledAuxiliary const & auxiliary() const
Definition: UnscheduledCallProducer.h:54
Frameworkfwd.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
T
long double T
Definition: Basic3DVectorLD.h:48
edm::Worker::hasAccumulator
virtual bool hasAccumulator() const =0
Worker.h
edm::UnscheduledCallProducer::runNowAsync
void runNowAsync(WaitingTask *task, typename T::MyPrincipal &p, EventSetupImpl const &es, ServiceToken const &token, StreamID streamID, typename T::Context const *topContext, U const *context) const
Definition: UnscheduledCallProducer.h:60
edm::UnscheduledCallProducer::end
const_iterator end() const
Definition: UnscheduledCallProducer.h:57
edm::UnscheduledAuxiliary::postModuleDelayedGetSignal_
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> postModuleDelayedGetSignal_
Definition: UnscheduledAuxiliary.h:46
edm::signalslot::Signal::connect
void connect(U iFunc)
Definition: Signal.h:62
edm::UnscheduledCallProducer::accumulatorWorkers_
worker_container accumulatorWorkers_
Definition: UnscheduledCallProducer.h:103
cms::Exception
Definition: Exception.h:70
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::UnscheduledCallProducer::runAccumulatorsAsync
void runAccumulatorsAsync(WaitingTask *task, typename T::MyPrincipal const &ep, EventSetupImpl const &es, ServiceToken const &token, StreamID streamID, ParentContext const &parentContext, typename T::Context const *context)
Definition: UnscheduledCallProducer.h:83
edm::UnscheduledCallProducer::unscheduledWorkers_
worker_container unscheduledWorkers_
Definition: UnscheduledCallProducer.h:102
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316