ATLAS Offline Software
PostClosedOutputsModule.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
9 
10 #include <EventLoop/Job.h>
11 #include <EventLoop/ModuleData.h>
12 #include <EventLoop/Worker.h>
14 
15 
16 //
17 // method implementations
18 //
19 
20 namespace EL
21 {
22  namespace Detail
23  {
26  {
27  // get executable if user provided one
28  std::string postCloseExec = data.m_worker->metaData()->castString (Job::optWorkerPostClosedOutputsExecutable, "");
29 
30  if (!postCloseExec.size()){
31  // user did not provide an excutable to be called after all outputs are closed
32  ANA_MSG_DEBUG ("PostClosedOutputsModule: no additionnal checks/actions performed after all outputs are closed");
33  return StatusCode::SUCCESS;
34  }
35 
36  // user provided an executable to be used
37  // loop over all outputs
38  for (auto & output : data.m_outputs){
39  std::string outputLabel = output.first;
40  std::string outputFileName = output.second.finalFileName();
41 
42  if (!outputFileName.size()){
43  ANA_MSG_WARNING ("PostClosedOutputsModule: empty outputFileName skipping outputLabel = "+outputLabel);
44  continue;
45  }
46 
47  // for instance execute a script checking that root files are not corrupted
48  std::string cmdLineToExecute = postCloseExec+" "+outputLabel+" "+outputFileName;
49 
50  ANA_MSG_INFO ("PostClosedOutputsModule: execute command line = '" << cmdLineToExecute << "'");
51  RCU::Shell::exec (cmdLineToExecute.c_str());
52  }
53  return StatusCode::SUCCESS;
54  }
55  }
56 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
EL::Detail::ModuleData
the data the EventLoop core classes are sharing with the Module implementation
Definition: ModuleData.h:64
Job.h
PostClosedOutputsModule.h
outputLabel
const std::string outputLabel
Definition: OverlapRemovalTester.cxx:69
ShellExec.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EL::Job::optWorkerPostClosedOutputsExecutable
static const std::string optWorkerPostClosedOutputsExecutable
Optionnal executable to be provided by the user that will be called, by the worker,...
Definition: Job.h:283
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:290
ANA_MSG_WARNING
#define ANA_MSG_WARNING(xmsg)
Macro printing warning messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:292
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
merge.output
output
Definition: merge.py:17
xAOD::DiTauJetParameters::Detail
Detail
Definition: DiTauDefs.h:38
Worker.h
RCU::Shell::exec
void exec(const std::string &cmd)
effects: execute the given command guarantee: strong failures: out of memory II failures: system fail...
Definition: ShellExec.cxx:29
ModuleData.h
EL::Detail::PostClosedOutputsModule::postFileClose
virtual StatusCode postFileClose(ModuleData &data) override
action at end of the worker job
Definition: PostClosedOutputsModule.cxx:25
AthenaPoolExample_Copy.outputFileName
string outputFileName
Definition: AthenaPoolExample_Copy.py:40
ANA_MSG_DEBUG
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:288