Skip to content

Commit 822009a

Browse files
committed
Make delayed get signal work with Refs
A de-reference of a Ref which causes a read from the source now triggers the delayed get signal and the source read signal.
1 parent 5b035c6 commit 822009a

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

FWCore/Framework/src/ProductResolvers.cc

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "FWCore/Framework/interface/DelayedReader.h"
1212
#include "FWCore/Framework/interface/TransitionInfoTypes.h"
1313
#include "FWCore/Framework/interface/ProductProvenanceRetriever.h"
14+
#include "FWCore/ServiceRegistry/interface/CurrentModuleOnThread.h"
1415
#include "DataFormats/Provenance/interface/BranchKey.h"
1516
#include "DataFormats/Provenance/interface/ParentageRegistry.h"
1617
#include "FWCore/MessageLogger/interface/MessageLogger.h"
@@ -176,11 +177,15 @@ namespace edm {
176177
// The file may already be closed so the reader is invalid
177178
return;
178179
}
179-
if (mcc and branchType == InEvent and aux_) {
180-
aux_->preModuleDelayedGetSignal_.emit(*(mcc->getStreamContext()), *mcc);
180+
auto context = mcc;
181+
if (!context) {
182+
context = CurrentModuleOnThread::getCurrentModuleOnThread();
183+
}
184+
if (context and branchType == InEvent and aux_) {
185+
aux_->preModuleDelayedGetSignal_.emit(*(context->getStreamContext()), *context);
181186
}
182187

183-
auto sentry(make_sentry(mcc, [this, branchType](ModuleCallingContext const* iContext) {
188+
auto sentry(make_sentry(context, [this, branchType](ModuleCallingContext const* iContext) {
184189
if (branchType == InEvent and aux_) {
185190
aux_->postModuleDelayedGetSignal_.emit(*(iContext->getStreamContext()), *iContext);
186191
}
@@ -194,13 +199,13 @@ namespace edm {
194199
if (not productResolved()) {
195200
try {
196201
//another thread could have beaten us here
197-
setProduct(reader->getProduct(productDescription().branchID(), &principal, mcc));
202+
setProduct(reader->getProduct(productDescription().branchID(), &principal, context));
198203
} catch (cms::Exception& e) {
199-
extendException(e, productDescription(), mcc);
204+
extendException(e, productDescription(), context);
200205
throw;
201206
} catch (std::exception const& e) {
202207
auto newExcept = edm::Exception(errors::StdException) << e.what();
203-
extendException(newExcept, productDescription(), mcc);
208+
extendException(newExcept, productDescription(), context);
204209
throw newExcept;
205210
}
206211
}

FWCore/Services/plugins/Tracer.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ void Tracer::preModuleEventDelayedGet(StreamContext const& sc, ModuleCallingCont
14481448
for (unsigned int i = 0; i < nIndents; ++i) {
14491449
out << indention_;
14501450
}
1451-
out << " starting: delayed processing event for module: stream = " << sc.streamID() << " label = '"
1451+
out << " starting: delayed get while processing event for module: stream = " << sc.streamID() << " label = '"
14521452
<< mcc.moduleDescription()->moduleLabel() << "' id = " << mcc.moduleDescription()->id();
14531453
if (dumpContextForLabels_.find(mcc.moduleDescription()->moduleLabel()) != dumpContextForLabels_.end()) {
14541454
out << "\n" << sc;
@@ -1463,7 +1463,7 @@ void Tracer::postModuleEventDelayedGet(StreamContext const& sc, ModuleCallingCon
14631463
for (unsigned int i = 0; i < nIndents; ++i) {
14641464
out << indention_;
14651465
}
1466-
out << " finished: delayed processing event for module: stream = " << sc.streamID() << " label = '"
1466+
out << " finished: delayed get while processing event for module: stream = " << sc.streamID() << " label = '"
14671467
<< mcc.moduleDescription()->moduleLabel() << "' id = " << mcc.moduleDescription()->id();
14681468
if (dumpContextForLabels_.find(mcc.moduleDescription()->moduleLabel()) != dumpContextForLabels_.end()) {
14691469
out << "\n" << sc;

0 commit comments

Comments
 (0)