ATLAS Offline Software
Loading...
Searching...
No Matches
EL::Detail::BatchInputModule Class Referencefinal

the IInputModule implementation for the batch driver More...

#include <BatchInputModule.h>

Inheritance diagram for EL::Detail::BatchInputModule:
Collaboration diagram for EL::Detail::BatchInputModule:

Public Member Functions

StatusCode processInputs (ModuleData &data, IInputModuleActions &actions) override
virtual StatusCode firstInitialize (ModuleData &data)
 action at the the very beginning of the worker job
virtual StatusCode preFileInitialize (ModuleData &data)
 action before opening the first file in the worker job
virtual StatusCode onInitialize (ModuleData &data)
 action just before algorithms are initialized
virtual StatusCode postFirstEvent (ModuleData &data)
 action after processing first event
virtual StatusCode onNewInputFile (ModuleData &data)
 actions after opening a new input file
virtual StatusCode onCloseInputFile (ModuleData &data)
 actions before closing an input file
virtual StatusCode postCloseInputFile (ModuleData &data)
 actions after CloseInputFile is called on the algorithms
virtual StatusCode onFileExecute (ModuleData &data)
 actions just before fileExecute is called on algorithms
virtual StatusCode onExecute (ModuleData &data)
 actions just before execute is called on algorithms
virtual StatusCode onFinalize (ModuleData &data)
 actions just before algorithms are finalized
virtual StatusCode postFinalize (ModuleData &data)
 actions after algorithms have been finalized
virtual StatusCode onWorkerEnd (ModuleData &data)
 action at the end of the worker job
virtual StatusCode postFileClose (ModuleData &data)
 action at end of the worker job
virtual void reportInputFailure (ModuleData &data)
 report that we failed to open our input file

Public Attributes

Gaudi::Property< int > jobId
Gaudi::Property< std::int64_t > maxEvents

Detailed Description

the IInputModule implementation for the batch driver

Definition at line 24 of file BatchInputModule.h.

Member Function Documentation

◆ firstInitialize()

StatusCode EL::Detail::Module::firstInitialize ( ModuleData & data)
virtualinherited

action at the the very beginning of the worker job

This gets called as early as possible in the worker initialization. Essentially all that should happen before this is to load all the modules. The main purpose is to start any benchmarks that are meant to capture the initialization process as well.

Reimplemented in EL::Detail::AlgorithmMemoryModule, EL::Detail::AlgorithmTimerModule, EL::Detail::MemoryMonitorModule, and EL::Detail::StopwatchModule.

Definition at line 25 of file Module.cxx.

27 {
28 return ::StatusCode::SUCCESS;
29 }

◆ onCloseInputFile()

StatusCode EL::Detail::Module::onCloseInputFile ( ModuleData & data)
virtualinherited

actions before closing an input file

Reimplemented in EL::Detail::AlgorithmStateModule, and EL::Detail::TreeCacheModule.

Definition at line 43 of file Module.cxx.

45 {
46 return ::StatusCode::SUCCESS;
47 }

◆ onExecute()

StatusCode EL::Detail::Module::onExecute ( ModuleData & data)
virtualinherited

actions just before execute is called on algorithms

For now that is mostly used to point input modules to the right event

Reimplemented in EL::Detail::AlgorithmStateModule, EL::Detail::GridReportingModule, EL::Detail::MemoryMonitorModule, and EL::Detail::TEventModule.

Definition at line 71 of file Module.cxx.

73 {
74 return ::StatusCode::SUCCESS;
75 }

◆ onFileExecute()

StatusCode EL::Detail::Module::onFileExecute ( ModuleData & data)
virtualinherited

actions just before fileExecute is called on algorithms

Reimplemented in EL::Detail::AlgorithmStateModule, EL::Detail::FileExecutedModule, and EL::Detail::StopwatchModule.

Definition at line 65 of file Module.cxx.

67 {
68 return ::StatusCode::SUCCESS;
69 }

◆ onFinalize()

StatusCode EL::Detail::Module::onFinalize ( ModuleData & data)
virtualinherited

actions just before algorithms are finalized

Reimplemented in EL::Detail::AlgorithmStateModule, and EL::Detail::MemoryMonitorModule.

Definition at line 89 of file Module.cxx.

91 {
92 return ::StatusCode::SUCCESS;
93 }

◆ onInitialize()

StatusCode EL::Detail::Module::onInitialize ( ModuleData & data)
virtualinherited

action just before algorithms are initialized

This is typically used for any setup that this module needs to do.

Reimplemented in EL::Detail::AlgorithmStateModule, EL::Detail::FactoryPreloadModule, EL::Detail::FileExecutedModule, EL::Detail::MemoryMonitorModule, EL::Detail::TEventModule, and EL::Detail::WorkerConfigModule.

Definition at line 77 of file Module.cxx.

79 {
80 return ::StatusCode::SUCCESS;
81 }

◆ onNewInputFile()

StatusCode EL::Detail::Module::onNewInputFile ( ModuleData & data)
virtualinherited

actions after opening a new input file

Reimplemented in EL::Detail::AlgorithmStateModule, EL::Detail::GridReportingModule, EL::Detail::TEventModule, and EL::Detail::TreeCacheModule.

Definition at line 37 of file Module.cxx.

39 {
40 return ::StatusCode::SUCCESS;
41 }

◆ onWorkerEnd()

StatusCode EL::Detail::Module::onWorkerEnd ( ModuleData & data)
virtualinherited

action at the end of the worker job

This is mostly meant/used to print job summary statements at the very end of worker job, and actually have them show up at or at least near the end of any log file.

Reimplemented in EL::Detail::LeakCheckModule, EL::Detail::MemoryMonitorModule, and EL::Detail::StopwatchModule.

Definition at line 101 of file Module.cxx.

103 {
104 return ::StatusCode::SUCCESS;
105 }

◆ postCloseInputFile()

StatusCode EL::Detail::Module::postCloseInputFile ( ModuleData & data)
virtualinherited

actions after CloseInputFile is called on the algorithms

Right now that is only used to disconnect the TEvent object from the input file.

Reimplemented in EL::Detail::TEventModule.

Definition at line 49 of file Module.cxx.

51 {
52 return ::StatusCode::SUCCESS;
53 }

◆ postFileClose()

StatusCode EL::Detail::Module::postFileClose ( ModuleData & data)
virtualinherited

action at end of the worker job

Executed just right before worker exit successfully at this stage all outputs have been created

Reimplemented in EL::Detail::GridReportingModule, and EL::Detail::PostClosedOutputsModule.

Definition at line 107 of file Module.cxx.

109 {
110 return ::StatusCode::SUCCESS;
111 }

◆ postFinalize()

StatusCode EL::Detail::Module::postFinalize ( ModuleData & data)
virtualinherited

actions after algorithms have been finalized

This is usually used to calculate some job summary information that is to be stored it in the histogram output file.

Reimplemented in EL::Detail::EventCountModule, EL::Detail::FileExecutedModule, EL::Detail::LeakCheckModule, EL::Detail::StopwatchModule, and EL::Detail::TEventModule.

Definition at line 95 of file Module.cxx.

97 {
98 return ::StatusCode::SUCCESS;
99 }

◆ postFirstEvent()

StatusCode EL::Detail::Module::postFirstEvent ( ModuleData & data)
virtualinherited

action after processing first event

This is mostly meant to set up benchmarks that record per-event performance. While a lot of initialization happens during initialize() there is a fair amount of initialization that happens on the first event, so when recording per-event performance the first event is sort of "special" and may need to be omitted.

Reimplemented in EL::Detail::LeakCheckModule, and EL::Detail::MemoryMonitorModule.

Definition at line 55 of file Module.cxx.

57 {
58 return ::StatusCode::SUCCESS;
59 }

◆ preFileInitialize()

StatusCode EL::Detail::Module::preFileInitialize ( ModuleData & data)
virtualinherited

action before opening the first file in the worker job

This is mostly meant to allow loading the dictionaries before any files and associated information is loaded.

Definition at line 31 of file Module.cxx.

33 {
34 return ::StatusCode::SUCCESS;
35 }

◆ processInputs()

StatusCode EL::Detail::BatchInputModule::processInputs ( ModuleData & data,
IInputModuleActions & actions )
overridevirtual

Inherited Members

Reimplemented from EL::Detail::Module.

Definition at line 30 of file BatchInputModule.cxx.

32 {
33 BatchSegment *segment = &data.m_batchJob->segments.at(jobId.value());
34 if (int (segment->job_id) != jobId.value())
35 {
36 ANA_MSG_ERROR ("inconsistenty in job id " << jobId.value() << " != " << segment->job_id);
37 return StatusCode::FAILURE;
38 }
39 BatchSample *sample = &data.m_batchJob->samples.at(segment->sample);
40
41 Long64_t beginFile = segment->begin_file;
42 Long64_t endFile = segment->end_file;
43 Long64_t lastFile = segment->end_file;
44 RCU_ASSERT (beginFile <= endFile);
45 Long64_t beginEvent = segment->begin_event;
46 Long64_t endEvent = segment->end_event;
47 if (endEvent > 0) endFile += 1;
48
49 for (Long64_t file = beginFile; file != endFile; ++ file)
50 {
51 RCU_ASSERT (std::size_t(file) < sample->files.size());
52 EventRange eventRange;
53 eventRange.m_url = sample->files[file];
54 eventRange.m_beginEvent = (file == beginFile ? beginEvent : 0);
55 eventRange.m_endEvent = (file == lastFile ? endEvent : EventRange::eof);
56 if (maxEvents != -1)
57 {
58 if (eventRange.m_endEvent == EventRange::eof)
59 {
60 ANA_CHECK (actions.openInputFile (eventRange.m_url));
61 eventRange.m_endEvent = actions.inputFileNumEntries();
62 }
63 eventRange.m_endEvent = std::min<std::uint64_t> (eventRange.m_endEvent, eventRange.m_beginEvent + maxEvents.value());
64 }
65
66 ANA_CHECK (actions.processEvents (eventRange));
67 }
68
69 return StatusCode::SUCCESS;
70 }
#define RCU_ASSERT(x)
Definition Assert.h:222
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Gaudi::Property< std::int64_t > maxEvents
Gaudi::Property< int > jobId
static constexpr Long64_t eof
the special value to indicate that the range includes all events until the end of the file
Definition EventRange.h:34
TFile * file

◆ reportInputFailure()

void EL::Detail::Module::reportInputFailure ( ModuleData & data)
virtualinherited

report that we failed to open our input file

Reimplemented in EL::Detail::GridReportingModule.

Definition at line 61 of file Module.cxx.

63 {}

Member Data Documentation

◆ jobId

Gaudi::Property<int> EL::Detail::BatchInputModule::jobId
Initial value:
{this, "jobId", -1,
"the id/index of the subjob we are processing"}

Definition at line 33 of file BatchInputModule.h.

33 {this, "jobId", -1,
34 "the id/index of the subjob we are processing"};

◆ maxEvents

Gaudi::Property<std::int64_t> EL::Detail::BatchInputModule::maxEvents
Initial value:
{this, "maxEvents", -1,
"the maximum number of events to process (-1 means all)"}

Definition at line 35 of file BatchInputModule.h.

35 {this, "maxEvents", -1,
36 "the maximum number of events to process (-1 means all)"};

The documentation for this class was generated from the following files: