ATLAS Offline Software
Loading...
Searching...
No Matches
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>
12#include <EventLoop/Worker.h>
14
15
16//
17// method implementations
18//
19
20namespace EL
21{
22 namespace Detail
23 {
24 StatusCode PostClosedOutputsModule ::
25 postFileClose (ModuleData& data)
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 & [outputLabel, outputPtr] : data.m_outputs){
39 if (outputLabel != outputPtr->mainStreamName()) continue;
40
41 const std::string& outputFileName = outputPtr->finalFileName();
42
43 if (!outputFileName.size()){
44 ANA_MSG_WARNING ("PostClosedOutputsModule: empty outputFileName skipping outputLabel = "+outputLabel);
45 continue;
46 }
47
48 // for instance execute a script checking that root files are not corrupted
49 std::string cmdLineToExecute = postCloseExec+" "+outputLabel+" "+outputFileName;
50
51 ANA_MSG_INFO ("PostClosedOutputsModule: execute command line = '" << cmdLineToExecute << "'");
52 RCU::Shell::exec (cmdLineToExecute.c_str());
53 }
54 return StatusCode::SUCCESS;
55 }
56 }
57}
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
#define ANA_MSG_WARNING(xmsg)
Macro printing warning messages.
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
const std::string outputLabel
static const std::string outputFileName
static const std::string optWorkerPostClosedOutputsExecutable
Optionnal executable to be provided by the user that will be called, by the worker,...
Definition Job.h:286
This module defines the arguments passed from the BATCH driver to the BATCH worker.
::StatusCode StatusCode
StatusCode definition for legacy code.
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
the data the EventLoop core classes are sharing with the Module implementation
Definition ModuleData.h:64