ATLAS Offline Software
Loading...
Searching...
No Matches
ExecDriver.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8//
9// includes
10//
11
13
16
17#include <cerrno>
18#include <cstring>
19#include <string>
20#include <unistd.h>
21#include <vector>
22
23//
24// method implementations
25//
26
28
29namespace EL
30{
31 void ExecDriver ::
32 testInvariant () const
33 {}
34
35
36
37 ExecDriver ::
38 ExecDriver ()
39 {
40 RCU_NEW_INVARIANT (this);
41 }
42
43
44
45 ::StatusCode ExecDriver ::
46 doManagerStep (Detail::ManagerData& data) const
47 {
48 RCU_READ_INVARIANT (this);
49 using namespace msgEventLoop;
51 switch (data.step)
52 {
54 {
55 data.batchSkipReleaseSetup = true;
56 }
57 break;
58
61 {
62 // pass the actual list of indices to process (on resubmit this is
63 // the list of failed segments, not 0..N-1), plus whether this is a
64 // resubmit so the worker can tolerate the already-existing scratch
65 // directories.
66 std::vector<std::string> args;
67 args.push_back ("eventloop_exec_worker");
68 args.push_back (data.submitDir);
69 args.push_back (data.resubmit ? "1" : "0");
70 for (std::size_t index : data.batchJobIndices)
71 args.push_back (std::to_string (index));
72
73 std::vector<char*> argv;
74 for (std::string& arg : args)
75 argv.push_back (const_cast<char*> (arg.c_str()));
76 argv.push_back (nullptr);
77
78 // this will replace the current program with a new one. that means
79 // that for better (or worse) we will not continue afterwards. this is
80 // fully intentional, as it releases all the memory we used for
81 // configuring the job. that is the whole point of this driver,
82 // releasing the >1GB of memory we use for configuration (in large parts
83 // ROOT-python dictionaries).
84 execvp(argv[0], argv.data());
85 auto myerrno = errno;
86 ANA_MSG_ERROR ("failed to execute eventloop_exec_worker: " << strerror (myerrno));
87 return ::StatusCode::FAILURE;
88 }
89 break;
90
91 default:
92 break;
93 }
94 return ::StatusCode::SUCCESS;
95 }
96}
#define RCU_NEW_INVARIANT(x)
Definition Assert.h:221
#define RCU_READ_INVARIANT(x)
Definition Assert.h:217
#define ANA_MSG_ERROR(xmsg,...)
Macro printing error messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
ClassImp(EL::ExecDriver) namespace EL
virtual::StatusCode doManagerStep(Detail::ManagerData &data) const override
a Driver for running batch jobs locally as a new process
Definition ExecDriver.h:27
@ doResubmit
call the actual doResubmit method
@ submitJob
do the actual job submission
Definition ManagerStep.h:92
@ batchScriptVar
create the variables needed for the batch-run script
Definition ManagerStep.h:83
This module defines the arguments passed from the BATCH driver to the BATCH worker.
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition index.py:1