art-framework-suite / art

The implementation of the art physics event processing framework
Other
2 stars 7 forks source link

scheduler.SkipEvent not working #127

Closed cerati closed 2 years ago

cerati commented 2 years ago

Describe the bug I am trying to have a workflow where if an exception is thrown in a given event, the art program does not terminate but skips to the next event. This functionality should be provided by scheduler.SkipEvent, but it does not seem to be working for the test below.

To Reproduce Setup: icaruscode v09_37_02_04 (larsoft v09_37_01_02). Fhicl file:

#include "cosmics_g4_icarus_sce_overburden.fcl"

physics.producers.testexcp: {module_type: "Exception"}
physics.simulate: ["rns","largeant","testexcp","ionization"]

outputs.rootoutput.SelectEvents: [simulate]
services.scheduler.FailPath: ["testexcp"]
services.scheduler.SkipEvent: ["TEST"]

Where the producer in Exception_module.cc only does:

void Exception::produce(art::Event& event)
{
  std::cout << "Exception Test - Event " << event.id().event() << std::endl;
  if ( (event.id().event()%2)==0 ) throw cet::exception("TEST") << "Throwing exception for event " << event.id().event();
  return;
}

However, when it gets to the first even event number the process ends:

%MSG-s ArtException:  PostEndJob 13-Jul-2022 16:12:01 CDT ModuleEndJob
---- EventProcessorFailure BEGIN
  EventProcessor: an exception occurred during current event processing
  ---- ScheduleExecutionFailure BEGIN
    Path: ProcessingStopped.
    ---- OtherArt BEGIN
      ---- TEST BEGIN
        Throwing exception for event 70The above exception was thrown while processing module Exception/testexcp run: 1 subRun: 0 event: 70
      ---- TEST END
    ---- OtherArt END
    Exception going through path simulate
  ---- ScheduleExecutionFailure END
---- EventProcessorFailure END
%MSG
Art has completed and will exit with status 1.

Note that the input file was generated with the same setup with:

lar -c prodcorsika_proton_intime_icarus_bnb_sce_on_ovb.fcl -n 100

(there is a filter so only 4 events are saved in the output)

If this is a high-priority issue Please add the "high priority" label to this issue.

knoepfel commented 2 years ago

@cerati, I confirm that the SkipEvent functionality does not appear to be working correctly. Is it possible for you to add the "TEST" exception category to the FailPath parameter to achieve somewhat equivalent behavior in the meantime? This would not stop the processing of the event, per se, but it would stop the execution of the path, and if any analyzers/output modules have specified SelectEvents: [...] with the path that "failed," then that event would not be further processed.

cerati commented 2 years ago

Thank you @knoepfel, that seems to work for my purpose! The job ends and all events are saved in artroot output file except the one that threw the exception

knoepfel commented 2 years ago

The problem is understood. We will include a fix for this in art 3.12.00.