Feature #11417

Feature #11415: Implement Run and SubRun fragments

Adjust state machine (and related mechanisms) to support more flexible output-file handling

Added by Kyle Knoepfel about 5 years ago. Updated over 4 years ago.

Event Loop
Target version:
Start date:
Due date:
% Done:


Estimated time:
60.00 h
Spent time:
SSI Package:


To support more flexible output-file handling, the state machine needs to be adjusted so that:

  • Each event, subrun, and run is queried to determine if a signal has been requested to close an output file.
  • Once the signal has been received, the output file must be closed at the user-specified boundary (on a new input file, new run, new subrun, or new event)
  • Ensure that all Run and SubRun fragments are written on all file switches (both input and output), to all outputs.

In addition to the state machine adjustments, a callable interface must be provided for output modules, so that the state machine can receive the signal to close.

It is not yet clear to what extent the state machine (and friends) need to be adjusted to support the above. It is likely that some of the mechanisms may already be in place for the required support. It is also quite likely that the description above as to what changes are required is somewhat inaccurate and incomplete.

sm_fragments.png (136 KB) sm_fragments.png Kyle Knoepfel, 03/16/2016 12:11 PM


#1 Updated by Kyle Knoepfel about 5 years ago

  • Status changed from New to Assigned
  • Assignee set to Kyle Knoepfel

#2 Updated by Kyle Knoepfel almost 5 years ago

  • Category set to Event Loop
  • Estimated time set to 60.00 h

The first step to implementing the adjustments is to remove continuation of Runs and SubRuns across file boundaries. This has been done by removing the ContinueRun1, ContinueRun2 and ContinueSubRun states. Aside from a handful of failures in the Statemachine_t* tests, all other tests pass.

The changes in the state machine tests should be expected, and correspond disabling continuation of subruns and runs across file boundaries. This means that subruns and runs are written to an output file at each input file boundary. The challenge now is to make sure that the subruns and runs are written to disk while the current input file is still open, thus obviating the need for principal caches.

#3 Updated by Kyle Knoepfel almost 5 years ago

An update:

The principal cache is still necessary as it is used for dealing with unhandled (Sub)Runs. I have been able to remove, however, the 'NewInputAndOutputFiles' state and make the state machine more agnostic to output-file closures, which are now handled via entry/exit/transition actions. The next challenge is to preserve the state of the EventProcessor when a call to switch files is made. I am attempting to use Boost statechart's concept of a deep-history state to achieve this. Not sure if it will work.

#4 Updated by Kyle Knoepfel almost 5 years ago

  • % Done changed from 0 to 50

#5 Updated by Kyle Knoepfel almost 5 years ago

  • % Done changed from 50 to 80

#6 Updated by Kyle Knoepfel almost 5 years ago

  • % Done changed from 80 to 100

The adjustments are nominally complete. Further improvements are possible--the importance of implementing those improvements should be weighed against other priorities. Will resolve pending approval from Marc, Paul and Chris.

#7 Updated by Kyle Knoepfel almost 5 years ago

  • Status changed from Assigned to Resolved

Implemented with many commits. The EPStates code has been factorized into a Machine.h header, and various source files corresponding to the composite states. These files now reside in a new directory: art/Framework/EventProcessor/StateMachine. Commits tracking changes to the files in this directory are:

#8 Updated by Kyle Knoepfel almost 5 years ago

See the attached image for a diagram of the new state machine.

#9 Updated by Kyle Knoepfel over 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF