ATLAS Offline Software
Loading...
Searching...
No Matches
ExecDriver.cxx File Reference
#include <EventLoop/ExecDriver.h>
#include <EventLoop/ManagerData.h>
#include <EventLoop/MessageCheck.h>
#include <cerrno>
#include <cstring>
#include <string>
#include <unistd.h>
#include <vector>
Include dependency graph for ExecDriver.cxx:

Go to the source code of this file.

Functions

 ClassImp (EL::ExecDriver) namespace EL

Function Documentation

◆ ClassImp()

ClassImp ( EL::ExecDriver )
Author
Nils Krumnack

Definition at line 27 of file ExecDriver.cxx.

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;
50 ANA_CHECK (BatchDriver::doManagerStep (data));
51 switch (data.step)
52 {
53 case Detail::ManagerStep::batchScriptVar:
54 {
55 data.batchSkipReleaseSetup = true;
56 }
57 break;
58
59 case Detail::ManagerStep::submitJob:
60 case Detail::ManagerStep::doResubmit:
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
Definition index.py:1