13 class ModuleBeginJobSignalSentry {
15 ModuleBeginJobSignalSentry(
ActivityRegistry*
a, ModuleDescription
const& md) : a_(a), md_(&md) {
17 a_->preModuleBeginJobSignal_(*md_);
19 ~ModuleBeginJobSignalSentry() {
21 a_->postModuleBeginJobSignal_(*md_);
26 ModuleDescription
const* md_;
29 class ModuleEndJobSignalSentry {
31 ModuleEndJobSignalSentry(
ActivityRegistry* a, ModuleDescription
const& md) : a_(a), md_(&md) {
33 a_->preModuleEndJobSignal_(*md_);
35 ~ModuleEndJobSignalSentry() {
37 a_->postModuleEndJobSignal_(*md_);
42 ModuleDescription
const* md_;
45 class ModuleBeginStreamSignalSentry {
47 ModuleBeginStreamSignalSentry(
ActivityRegistry* a, StreamContext
const&
sc, ModuleCallingContext
const& mcc)
48 : a_(a), sc_(sc), mcc_(mcc) {
50 a_->preModuleBeginStreamSignal_(sc_, mcc_);
52 ~ModuleBeginStreamSignalSentry() {
54 a_->postModuleBeginStreamSignal_(sc_, mcc_);
59 StreamContext
const& sc_;
60 ModuleCallingContext
const& mcc_;
63 class ModuleEndStreamSignalSentry {
65 ModuleEndStreamSignalSentry(
ActivityRegistry* a, StreamContext
const& sc, ModuleCallingContext
const& mcc)
66 : a_(a), sc_(sc), mcc_(mcc) {
68 a_->preModuleEndStreamSignal_(sc_, mcc_);
70 ~ModuleEndStreamSignalSentry() {
72 a_->postModuleEndStreamSignal_(sc_, mcc_);
77 StreamContext
const& sc_;
78 ModuleCallingContext
const& mcc_;
91 numberOfPathsLeftToRun_(0),
92 moduleCallingContext_(&iMD),
98 ranAcquireWithoutException_(
false) {}
107 std::ostringstream iost;
109 iost <<
"Prefetching for module ";
111 iost <<
"Calling method for module ";
116 iost <<
" (probably inside some kind of mixing module)";
123 std::ostringstream ost;
125 ost <<
"Prefetching for module ";
127 ost <<
"Calling method for module ";
134 ost <<
"Running path '";
213 iTask->increment_ref_count();
214 for (
auto const& item : items) {
216 bool skipCurrentProcess = item.skipCurrentProcess();
226 if (0 == iTask->decrement_ref_count()) {
228 tbb::task::spawn(*iTask);
236 successTask->increment_ref_count();
239 tbb::task::allocate_root(), [
id, successTask, iPrincipal,
this, token](std::exception_ptr
const*) {
243 timesRun_.fetch_add(1, std::memory_order_relaxed);
247 if (0 == successTask->decrement_ref_count()) {
254 if (0 == successTask->decrement_ref_count()) {
255 tbb::task::spawn(*successTask);
261 std::vector<ProductResolverIndexAndSkipBit>
items;
264 for (
auto const& item : items) {
266 bool skipCurrentProcess = item.skipCurrentProcess();
271 choiceHolder.doneWaiting(std::exception_ptr{});
292 std::ostringstream ost;
307 std::ostringstream ost;
330 std::ostringstream ost;
354 std::ostringstream ost;
385 timesRun_.fetch_add(1, std::memory_order_relaxed);
397 std::exception_ptr exceptionPtr;
402 exceptionPtr = *iEPtr;
410 exceptionPtr = std::current_exception();
425 return std::current_exception();
434 : m_worker(worker), m_runModuleTask(runModuleTask), m_parentContext(parentContext) {}
std::string const & pathName() const
GlobalContext const * globalContext() const
void resetModuleDescription(ModuleDescription const *)
void setTimestamp(Timestamp const &v)
ModuleDescription const & description() const
void setState(State state)
std::atomic< int > numberOfPathsLeftToRun_
unsigned int ProductResolverIndex
StreamContext const * getStreamContext() const
ModuleCallingContext const * moduleCallingContext() const
void setEarlyDeleteHelper(EarlyDeleteHelper *iHelper)
ModuleCallingContext const * getTopModuleCallingContext() const
static void exceptionContext(cms::Exception &ex, ModuleCallingContext const *mcc)
void runAcquireAfterAsyncPrefetch(std::exception_ptr const *iEPtr, EventPrincipal const &ep, EventSetupImpl const &es, ParentContext const &parentContext, WaitingTaskWithArenaHolder holder)
ParentContext const m_parentContext
InternalContext const * internalContext() const
WaitingTask * m_runModuleTask
std::shared_ptr< ActivityRegistry > actReg_
std::string const & moduleName() const
std::string const & category() const
exception_actions::ActionCodes find(const std::string &category) const
ModuleCallingContext const * moduleCallingContext() const
void beginStream(StreamID id, StreamContext &streamContext)
void exceptionContext(std::ostream &, GlobalContext const &)
ExceptionToActionTable const * actions_
std::string const & moduleLabel() const
void setContext(State state, ParentContext const &parent, ModuleCallingContext const *previousOnThread)
bool ranAcquireWithoutException_
void setActivityRegistry(std::shared_ptr< ActivityRegistry > areg)
ParentContext const & parent() const
void prefetchAsync(WaitingTask *waitTask, ProductResolverIndex index, bool skipCurrentProcess, ServiceToken const &token, ModuleCallingContext const *mcc) const
ModuleCallingContext moduleCallingContext_
virtual void itemsToGetForSelection(std::vector< ProductResolverIndexAndSkipBit > &) const =0
void setTransition(Transition v)
std::exception_ptr cached_exception_
static RunIndex invalidRunIndex()
tbb::task * execute() override
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
void doneWaiting(std::exception_ptr iExcept)
bool shouldRethrowException(std::exception_ptr iPtr, ParentContext const &parentContext, bool isEvent, TransitionIDValueBase const &iID) const
edm::WaitingTaskList waitingTasks_
void doneWaiting(std::exception_ptr iExcept)
HandleExternalWorkExceptionTask(Worker *worker, WaitingTask *runModuleTask, ParentContext const &parentContext)
void setLuminosityBlockIndex(LuminosityBlockIndex const &v)
BranchType const & branchType() const
PathContext const * pathContext() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
ModuleDescription const * moduleDescription() const
virtual void implDoAcquire(EventPrincipal const &, EventSetupImpl const &c, ModuleCallingContext const *mcc, WaitingTaskWithArenaHolder &holder)=0
Worker(ModuleDescription const &iMD, ExceptionToActionTable const *iActions)
std::atomic< State > state_
void prefetchAsync(WaitingTask *, ServiceToken const &, ParentContext const &parentContext, Principal const &)
virtual void implEndJob()=0
StreamContext const * streamContext() const
static LuminosityBlockIndex invalidLuminosityBlockIndex()
virtual bool implDoPrePrefetchSelection(StreamID id, EventPrincipal const &ep, ModuleCallingContext const *mcc)=0
void prePrefetchSelectionAsync(WaitingTask *task, ServiceToken const &, StreamID stream, EventPrincipal const *)
virtual void implBeginJob()=0
FunctorWaitingTask< F > * make_waiting_task(ALLOC &&iAlloc, F f)
void addContext(std::string const &context)
virtual void implBeginStream(StreamID)=0
virtual std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom(BranchType) const =0
virtual void implEndStream(StreamID)=0
StreamContext const * streamContext() const
void setEventID(EventID const &v)
ModuleCallingContext const * previousModuleOnThread() const
void runAcquire(EventPrincipal const &ep, EventSetupImpl const &es, ParentContext const &parentContext, WaitingTaskWithArenaHolder &holder)
void endStream(StreamID id, StreamContext &streamContext)
void postDoEvent(EventPrincipal const &)
auto wrap(F iFunc) -> decltype(iFunc())
edm::propagate_const< EarlyDeleteHelper * > earlyDeleteHelper_
virtual void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &moduleCallingContext, Principal const &iPrincipal) const =0
std::atomic< int > timesRun_
std::exception_ptr const * exceptionPtr() const
Returns exception thrown by dependent task.
PlaceInPathContext const * placeInPathContext() const
void setRunIndex(RunIndex const &v)
std::exception_ptr handleExternalWorkException(std::exception_ptr const *iEPtr, ParentContext const &parentContext)
void printCmsExceptionWarning(char const *behavior, cms::Exception const &e)