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 //
26 
27 #include <vector>
28 #include <unordered_map>
29 #include <string>
30 #include <sstream>
31 #include <cassert>
32 
33 namespace edm {
34 
35  class EventTransitionInfo;
36  class ModuleCallingContext;
37 
39  public:
40  using worker_container = std::vector<Worker*>;
41  using const_iterator = worker_container::const_iterator;
42 
46  }
47  void addWorker(Worker* aWorker) {
48  assert(nullptr != aWorker);
49  unscheduledWorkers_.push_back(aWorker);
50  if (aWorker->hasAccumulator()) {
51  accumulatorWorkers_.push_back(aWorker);
52  }
53  }
54 
55  void removeWorker(Worker const* worker) {
57  unscheduledWorkers_.end());
59  accumulatorWorkers_.end());
60  }
61 
63 
64  UnscheduledAuxiliary const& auxiliary() const { return aux_; }
65 
66  const_iterator begin() const { return unscheduledWorkers_.begin(); }
67  const_iterator end() const { return unscheduledWorkers_.end(); }
68 
69  template <typename T, typename U>
71  typename T::TransitionInfoType const& info,
72  ServiceToken const& token,
73  StreamID streamID,
74  typename T::Context const* topContext,
75  U const* context) const {
76  //do nothing for event since we will run when requested
77  if (!T::isEvent_) {
78  for (auto worker : unscheduledWorkers_) {
79  ParentContext parentContext(context);
80 
81  // We do not need to run prefetching here because this only handles
82  // stream transitions for runs and lumis. There are no products put
83  // into the runs or lumis in stream transitions, so there can be
84  // no data dependencies which require prefetching. Prefetching is
85  // needed for global transitions, but they are run elsewhere.
86  worker->doWorkNoPrefetchingAsync<T>(task, info, token, streamID, parentContext, topContext);
87  }
88  }
89  }
90 
91  template <typename T>
93  typename T::TransitionInfoType const& info,
94  ServiceToken const& token,
95  StreamID streamID,
96  ParentContext const& parentContext,
97  typename T::Context const* context) {
98  for (auto worker : accumulatorWorkers_) {
99  worker->doWorkAsync<T>(task, info, token, streamID, parentContext, context);
100  }
101  }
102 
103  private:
104  template <typename T, typename ID>
105  void addContextToException(cms::Exception& ex, Worker const* worker, ID const& id) const {
106  std::ostringstream ost;
107  ost << "Processing " << T::transitionName() << " " << id;
108  ex.addContext(ost.str());
109  }
113  };
114 
115 } // namespace edm
116 
117 #endif
edm::UnscheduledCallProducer::addContextToException
void addContextToException(cms::Exception &ex, Worker const *worker, ID const &id) const
Definition: UnscheduledCallProducer.h:105
edm::EventTransitionInfo
Definition: TransitionInfoTypes.h:26
edm::StreamID
Definition: StreamID.h:30
edm::UnscheduledCallProducer::UnscheduledCallProducer
UnscheduledCallProducer(ActivityRegistry &iReg)
Definition: UnscheduledCallProducer.h:43
edm::UnscheduledCallProducer
Definition: UnscheduledCallProducer.h:38
cms::Exception::addContext
void addContext(std::string const &context)
Definition: Exception.cc:165
WaitingTaskHolder.h
edm
HLT enums.
Definition: AlignableModifier.h:19
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
cms::cuda::assert
assert(be >=bs)
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
ActivityRegistry.h
visDQMUpload.context
context
Definition: visDQMUpload.py:37
BranchActionType.h
edm::ServiceToken
Definition: ServiceToken.h:42
edm::UnscheduledCallProducer::aux_
UnscheduledAuxiliary aux_
Definition: UnscheduledCallProducer.h:112
edm::UnscheduledCallProducer::const_iterator
worker_container::const_iterator const_iterator
Definition: UnscheduledCallProducer.h:41
TrackValidation_cff.task
task
Definition: TrackValidation_cff.py:253
edm::ActivityRegistry
Definition: ActivityRegistry.h:134
edm::UnscheduledCallProducer::setEventTransitionInfo
void setEventTransitionInfo(EventTransitionInfo const &info)
Definition: UnscheduledCallProducer.h:62
edm::Worker
Definition: Worker.h:91
edm::UnscheduledAuxiliary::preModuleDelayedGetSignal_
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> preModuleDelayedGetSignal_
Definition: UnscheduledAuxiliary.h:43
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::ParentContext
Definition: ParentContext.h:27
edm::ActivityRegistry::postModuleEventDelayedGetSignal_
PostModuleEventDelayedGet postModuleEventDelayedGetSignal_
Definition: ActivityRegistry.h:828
edm::UnscheduledAuxiliary::setEventTransitionInfo
void setEventTransitionInfo(EventTransitionInfo const &info)
Definition: UnscheduledAuxiliary.h:41
align::ID
uint32_t ID
Definition: Definitions.h:24
edm::WaitingTaskHolder
Definition: WaitingTaskHolder.h:32
edm::UnscheduledCallProducer::addWorker
void addWorker(Worker *aWorker)
Definition: UnscheduledCallProducer.h:47
UnscheduledAuxiliary.h
edm::UnscheduledCallProducer::removeWorker
void removeWorker(Worker const *worker)
Definition: UnscheduledCallProducer.h:55
edm::UnscheduledCallProducer::begin
const_iterator begin() const
Definition: UnscheduledCallProducer.h:66
edm::ActivityRegistry::preModuleEventDelayedGetSignal_
PreModuleEventDelayedGet preModuleEventDelayedGetSignal_
Definition: ActivityRegistry.h:820
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::UnscheduledAuxiliary
Definition: UnscheduledAuxiliary.h:33
edm::UnscheduledCallProducer::worker_container
std::vector< Worker * > worker_container
Definition: UnscheduledCallProducer.h:40
OccurrenceTraits.h
ParentContext.h
edm::UnscheduledCallProducer::auxiliary
UnscheduledAuxiliary const & auxiliary() const
Definition: UnscheduledCallProducer.h:64
Frameworkfwd.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
T
long double T
Definition: Basic3DVectorLD.h:48
edm::Worker::hasAccumulator
virtual bool hasAccumulator() const =0
Worker.h
edm::UnscheduledCallProducer::end
const_iterator end() const
Definition: UnscheduledCallProducer.h:67
MatrixUtil.remove
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:219
edm::UnscheduledAuxiliary::postModuleDelayedGetSignal_
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> postModuleDelayedGetSignal_
Definition: UnscheduledAuxiliary.h:44
edm::signalslot::Signal::connect
void connect(U iFunc)
Definition: Signal.h:64
edm::UnscheduledCallProducer::accumulatorWorkers_
worker_container accumulatorWorkers_
Definition: UnscheduledCallProducer.h:111
cms::Exception
Definition: Exception.h:70
edm::UnscheduledCallProducer::unscheduledWorkers_
worker_container unscheduledWorkers_
Definition: UnscheduledCallProducer.h:110
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316