Bug #22931
beginRun is called more than once in a Shared Module
Description
I have constructed a Shared Producer Module for Mu2e Offline and have run it with two schedules. I am finding that beginRun is being called twice, once from each Schedule. Since Shared Module should only have one instance of the module, beginRun should only be called once.
History
#1 Updated by Paul Russo over 1 year ago
There is an actual reason why it is explicitly called for each schedule. Imagine a module that has an array indexed by schedule id that that accumulates information over the duration of a run (separately for each schedule). The begin run callback is a good place to setup the entries of this array for each schedule.
So the expected behavior is that the shared module checks the schedule id. If it is doing schedule-specific work, then it can do an if test on the schedule id, and if it is not, then it can just do the work only for schedule id 0 (also an if test on the schedule id).
#2 Updated by Kyle Knoepfel over 1 year ago
This will require a discussion, Paul. Currently, art calls beginRun n times for n schedules for a shared module but endRun only once for that same module. I do not believe this asymmetry is intentional. We should resolve it.
#3 Updated by Paul Russo over 1 year ago
No argument there, just pointing out that it isn't as trivial as it seems at first glance. :-)
#4 Updated by Kyle Knoepfel over 1 year ago
- Status changed from New to Accepted
#5 Updated by Kyle Knoepfel over 1 year ago
- % Done changed from 0 to 100
- Assignee set to Kyle Knoepfel
- Status changed from Accepted to Resolved
- Category set to Infrastructure
- Project changed from cet-is to art
This bug has been fixed with commit art:1ec3d3c.
#6 Updated by Kyle Knoepfel over 1 year ago
- Target version set to 3.03.01
#7 Updated by Kyle Knoepfel over 1 year ago
- Status changed from Resolved to Closed