Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Service callbacks for Run and Lumi writing #28562

Merged
merged 1 commit into from
Dec 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 60 additions & 2 deletions FWCore/Framework/src/Schedule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1136,17 +1136,75 @@ namespace edm {
ProcessContext const* processContext,
ActivityRegistry* activityRegistry,
MergeableRunProductMetadata const* mergeableRunProductMetadata) {
auto token = ServiceRegistry::instance().presentToken();
GlobalContext globalContext(GlobalContext::Transition::kWriteRun,
LuminosityBlockID(rp.run(), 0),
rp.index(),
LuminosityBlockIndex::invalidLuminosityBlockIndex(),
rp.endTime(),
processContext);
auto t =
make_waiting_task(tbb::task::allocate_root(),
[task, activityRegistry, globalContext, token](std::exception_ptr const* iExcept) mutable {
try {
//services can depend on other services
ServiceRegistry::Operate op(token);

activityRegistry->postGlobalWriteRunSignal_(globalContext);
} catch (...) {
}
std::exception_ptr ptr;
if (iExcept) {
ptr = *iExcept;
}
task.doneWaiting(ptr);
});
try {
activityRegistry->preGlobalWriteRunSignal_(globalContext);
} catch (...) {
}
WaitingTaskHolder tHolder(t);

for (auto& c : all_output_communicators_) {
c->writeRunAsync(task, rp, processContext, activityRegistry, mergeableRunProductMetadata);
c->writeRunAsync(tHolder, rp, processContext, activityRegistry, mergeableRunProductMetadata);
}
}

void Schedule::writeLumiAsync(WaitingTaskHolder task,
LuminosityBlockPrincipal const& lbp,
ProcessContext const* processContext,
ActivityRegistry* activityRegistry) {
auto token = ServiceRegistry::instance().presentToken();
GlobalContext globalContext(GlobalContext::Transition::kWriteLuminosityBlock,
lbp.id(),
lbp.runPrincipal().index(),
lbp.index(),
lbp.beginTime(),
processContext);

auto t =
make_waiting_task(tbb::task::allocate_root(),
[task, activityRegistry, globalContext, token](std::exception_ptr const* iExcept) mutable {
try {
//services can depend on other services
ServiceRegistry::Operate op(token);

activityRegistry->postGlobalWriteLumiSignal_(globalContext);
} catch (...) {
}
std::exception_ptr ptr;
if (iExcept) {
ptr = *iExcept;
}
task.doneWaiting(ptr);
});
try {
activityRegistry->preGlobalWriteLumiSignal_(globalContext);
} catch (...) {
}
WaitingTaskHolder tHolder(t);
for (auto& c : all_output_communicators_) {
c->writeLumiAsync(task, lbp, processContext, activityRegistry);
c->writeLumiAsync(tHolder, lbp, processContext, activityRegistry);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,8 @@ ModuleCallingContext state = Running
++++++ starting: global end lumi for module: label = 'get' id = 3
++++++ finished: global end lumi for module: label = 'get' id = 3
++++ finished: global end lumi: run = 1 lumi = 1 time = 1000000
++++ starting: global write lumi: run = 1 lumi = 1 time = 1000000
++++ finished: global write lumi: run = 1 lumi = 1 time = 1000000
++++ starting: end run: stream = 0 run = 1 time = 1000030
++++++ starting: end run for module: stream = 0 label = 'one' id = 4
StreamContext: StreamID = 0 transition = EndRun
Expand Down Expand Up @@ -543,6 +545,8 @@ ModuleCallingContext state = Running
++++++ starting: global end run for module: label = 'get' id = 3
++++++ finished: global end run for module: label = 'get' id = 3
++++ finished: global end run 1 : time = 1000030
++++ starting: global write run 1 : time = 1000030
++++ finished: global write run 1 : time = 1000030
++++ starting: end stream for module: stream = 0 label = 'get' id = 3
++++ finished: end stream for module: stream = 0 label = 'get' id = 3
++++ starting: end stream for module: stream = 0 label = 'TriggerResults' id = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@
++++++ starting: global end lumi for module: label = 'getTwo' id = 6
++++++ finished: global end lumi for module: label = 'getTwo' id = 6
++++ finished: global end lumi: run = 1 lumi = 1 time = 1000000
++++ starting: global write lumi: run = 1 lumi = 1 time = 1000000
++++ finished: global write lumi: run = 1 lumi = 1 time = 1000000
++++ starting: end run: stream = 0 run = 1 time = 1000030
++++++ starting: end run for module: stream = 0 label = 'two' id = 5
++++++ finished: end run for module: stream = 0 label = 'two' id = 5
Expand All @@ -175,6 +177,8 @@
++++++ starting: global end run for module: label = 'getTwo' id = 6
++++++ finished: global end run for module: label = 'getTwo' id = 6
++++ finished: global end run 1 : time = 1000030
++++ starting: global write run 1 : time = 1000030
++++ finished: global write run 1 : time = 1000030
++++ starting: end stream for module: stream = 0 label = 'one' id = 3
++++ finished: end stream for module: stream = 0 label = 'one' id = 3
++++ starting: end stream for module: stream = 0 label = 'getOne' id = 4
Expand Down
52 changes: 52 additions & 0 deletions FWCore/Integration/test/unit_test_outputs/testGetBy1.log
Original file line number Diff line number Diff line change
Expand Up @@ -906,8 +906,34 @@ GlobalContext: transition = EndLuminosityBlock
ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994
parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b

++++ starting: global write lumi: run = 1 lumi = 1 time = 1
GlobalContext: transition = WriteLuminosityBlock
run: 1 luminosityBlock: 1
runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1
ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b

++++++ starting: write lumi for module: label = 'out' id = 8
++++++ finished: write lumi for module: label = 'out' id = 8
++++ finished: global write lumi: run = 1 lumi = 1 time = 1
GlobalContext: transition = WriteLuminosityBlock
run: 1 luminosityBlock: 1
runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1
ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b

++++ starting: global write lumi: run = 1 lumi = 1 time = 1
GlobalContext: transition = WriteLuminosityBlock
run: 1 luminosityBlock: 1
runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1
ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994
parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b

++++ finished: global write lumi: run = 1 lumi = 1 time = 1
GlobalContext: transition = WriteLuminosityBlock
run: 1 luminosityBlock: 1
runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1
ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994
parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b

++++ starting: end run: stream = 0 run = 1 time = 15000001
StreamContext: StreamID = 0 transition = EndRun
run: 1 lumi: 0 event: 0
Expand Down Expand Up @@ -998,8 +1024,34 @@ GlobalContext: transition = EndRun
ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994
parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b

++++ starting: global write run 1 : time = 15000001
GlobalContext: transition = WriteRun
run: 1 luminosityBlock: 0
runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001
ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b

++++++ starting: write run for module: label = 'out' id = 8
++++++ finished: write run for module: label = 'out' id = 8
++++ finished: global write run 1 : time = 15000001
GlobalContext: transition = WriteRun
run: 1 luminosityBlock: 0
runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001
ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b

++++ starting: global write run 1 : time = 0
GlobalContext: transition = WriteRun
run: 1 luminosityBlock: 0
runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0
ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994
parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b

++++ finished: global write run 1 : time = 0
GlobalContext: transition = WriteRun
run: 1 luminosityBlock: 0
runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 0
ProcessContext: COPY 5ea2a17b2b2eaa97af73c630882cd994
parent ProcessContext: PROD1 2f9cb7fb91f77860cb45771073f1116b

++++ starting: end stream for module: stream = 0 label = 'intProducer' id = 4
++++ finished: end stream for module: stream = 0 label = 'intProducer' id = 4
++++ starting: end stream for module: stream = 0 label = 'a1' id = 5
Expand Down
24 changes: 24 additions & 0 deletions FWCore/Integration/test/unit_test_outputs/testGetBy2.log
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,20 @@ GlobalContext: transition = EndLuminosityBlock
runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1
ProcessContext: PROD2 7da3661f4f7dead5e42f07cf3ddf5a59

++++ starting: global write lumi: run = 1 lumi = 1 time = 1
GlobalContext: transition = WriteLuminosityBlock
run: 1 luminosityBlock: 1
runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1
ProcessContext: PROD2 7da3661f4f7dead5e42f07cf3ddf5a59

++++++ starting: write lumi for module: label = 'out' id = 5
++++++ finished: write lumi for module: label = 'out' id = 5
++++ finished: global write lumi: run = 1 lumi = 1 time = 1
GlobalContext: transition = WriteLuminosityBlock
run: 1 luminosityBlock: 1
runIndex = 0 luminosityBlockIndex = 0 unixTime = 0 microsecondOffset = 1
ProcessContext: PROD2 7da3661f4f7dead5e42f07cf3ddf5a59

++++ starting: end run: stream = 0 run = 1 time = 15000001
StreamContext: StreamID = 0 transition = EndRun
run: 1 lumi: 0 event: 0
Expand Down Expand Up @@ -739,8 +751,20 @@ GlobalContext: transition = EndRun
runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001
ProcessContext: PROD2 7da3661f4f7dead5e42f07cf3ddf5a59

++++ starting: global write run 1 : time = 15000001
GlobalContext: transition = WriteRun
run: 1 luminosityBlock: 0
runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001
ProcessContext: PROD2 7da3661f4f7dead5e42f07cf3ddf5a59

++++++ starting: write run for module: label = 'out' id = 5
++++++ finished: write run for module: label = 'out' id = 5
++++ finished: global write run 1 : time = 15000001
GlobalContext: transition = WriteRun
run: 1 luminosityBlock: 0
runIndex = 0 luminosityBlockIndex = 4294967295 unixTime = 0 microsecondOffset = 15000001
ProcessContext: PROD2 7da3661f4f7dead5e42f07cf3ddf5a59

++++ starting: close input file: lfn = file:testGetBy1.root usedFallBack = 0
++++ finished: close input file: lfn = file:testGetBy1.root usedFallBack = 0
++++ starting: end stream for module: stream = 0 label = 'intProducer' id = 4
Expand Down
Loading