ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDTools
EventLoop
Root
CondorDriver.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
8
//
9
// includes
10
//
11
12
#include <
EventLoop/CondorDriver.h
>
13
14
#include <
AsgMessaging/StatusCode.h
>
15
#include <
EventLoop/BatchJob.h
>
16
#include <
EventLoop/Job.h
>
17
#include <
EventLoop/ManagerData.h
>
18
#include <
EventLoop/MessageCheck.h
>
19
#include <
RootCoreUtils/Assert.h
>
20
#include <
RootCoreUtils/ShellExec.h
>
21
#include <TSystem.h>
22
#include <fstream>
23
#include <memory>
24
#include <sstream>
25
#include <cstdlib>
26
#include <filesystem>
27
28
//
29
// method implementations
30
//
31
32
ClassImp
(
EL::CondorDriver
)
33
34
namespace
EL
35
{
36
void
CondorDriver ::
37
testInvariant ()
const
38
{}
39
40
41
42
CondorDriver ::
43
CondorDriver ()
44
{
45
RCU_NEW_INVARIANT
(
this
);
46
}
47
48
49
50
::StatusCode
CondorDriver ::
51
doManagerStep (Detail::ManagerData& data)
const
52
{
53
RCU_READ_INVARIANT
(
this
);
54
using namespace
msgEventLoop;
55
ANA_CHECK
(
BatchDriver::doManagerStep
(data));
56
switch
(data.step)
57
{
58
case
Detail::ManagerStep::batchScriptVar
:
59
{
60
data.batchInit =
"export PATH LD_LIBRARY_PATH PYTHONPATH"
;
61
}
62
break
;
63
64
case
Detail::ManagerStep::submitJob
:
65
case
Detail::ManagerStep::doResubmit
:
66
{
67
// name of tarball being made (this needs to match BatchDriver.cxx)
68
const
std::string tarballName(
"AnalysisPackage.tar.gz"
);
69
70
if
(!data.resubmit)
71
{
72
if
(!data.sharedFileSystem)
73
{
74
const
std::string newLocation = data.submitDir +
"/submit/"
+ tarballName;
75
int
status=gSystem->CopyFile(tarballName.c_str(),newLocation.c_str());
76
if
(status != 0)
77
{
78
ANA_MSG_ERROR
(
"failed to copy "
<< tarballName <<
" to "
<< newLocation);
79
return ::StatusCode::FAILURE;
80
}
81
}
82
}
83
84
{
85
std::ofstream
file
((data.submitDir +
"/submit/submit"
).c_str());
86
file
<<
"executable = run\n"
;
87
file
<<
"universe = vanilla\n"
;
88
file
<<
"log = submit/run.log\n"
;
89
file
<<
"output = submit/log-$(Item).out\n"
;
90
file
<<
"error = submit/log-$(Item).err\n"
;
91
file
<<
"initialdir = "
<< data.submitDir <<
"\n"
;
92
if
(!data.sharedFileSystem)
93
{
// Transfer data with non-shared file-systems
94
file
<<
"should_transfer_files = YES\n"
;
95
file
<<
"when_to_transfer_output = ON_EXIT\n"
;
96
file
<<
"transfer_input_files = submit/"
<< tarballName <<
", submit/segments, submit/config.root\n"
;
97
file
<<
"transfer_output_files = fetch, status\n"
;
98
if
(
char
* x509userproxy = std::getenv(
"X509_USER_PROXY"
)) {
99
std::filesystem::path proxyPath(x509userproxy);
100
std::filesystem::path proxyPathDestination(data.submitDir +
"/submit/"
+ proxyPath.filename().string());
101
std::filesystem::copy(proxyPath,
102
proxyPathDestination,
103
std::filesystem::copy_options::overwrite_existing);
104
file
<<
"x509userproxy = "
<< proxyPathDestination.string() <<
"\n"
;
105
}
106
else
{
107
ANA_MSG_INFO
(
"X509_USER_PROXY not set"
);
108
}
109
}
110
file
<<
"arguments = $(Item)\n"
;
111
file
<<
"\n"
<< data.options.castString (
Job::optCondorConf
) <<
"\n"
;
112
file
<<
"queue in ( "
;
113
bool
first {
true
};
114
for
(std::size_t
index
: data.batchJobIndices)
115
{
116
if
(first)
117
first =
false
;
118
else
119
file
<<
", "
;
120
file
<<
index
;
121
}
122
file
<<
" )\n"
;
123
}
124
125
{
126
std::ostringstream cmd;
127
cmd <<
"cd "
<<
RCU::Shell::quote
(data.submitDir) <<
"/submit && condor_submit "
128
<< data.options.castString (
Job::optSubmitFlags
) <<
" submit"
;
129
if
(gSystem->Exec (cmd.str().c_str()) != 0)
130
{
131
ANA_MSG_ERROR
(
"failed to execute: "
<< cmd.str());
132
return ::StatusCode::FAILURE;
133
}
134
}
135
data.submitted =
true
;
136
}
137
break
;
138
139
default
:
140
break
;
141
}
142
return ::StatusCode::SUCCESS;
143
}
144
}
Assert.h
RCU_NEW_INVARIANT
#define RCU_NEW_INVARIANT(x)
Definition
Assert.h:221
RCU_READ_INVARIANT
#define RCU_READ_INVARIANT(x)
Definition
Assert.h:217
BatchJob.h
ClassImp
ClassImp(EL::CondorDriver) namespace EL
Definition
CondorDriver.cxx:32
CondorDriver.h
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg,...)
Macro printing error messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:295
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg,...)
Macro printing info messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:291
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:325
StatusCode.h
Job.h
ManagerData.h
MessageCheck.h
ShellExec.h
EL::BatchDriver::doManagerStep
virtual::StatusCode doManagerStep(Detail::ManagerData &data) const override
EL::CondorDriver
a Driver to run on Condor batch systems
Definition
CondorDriver.h:21
EL::Job::optCondorConf
static const std::string optCondorConf
description: the name of the option for supplying extra parameters for condor systems
Definition
Job.h:298
EL::Job::optSubmitFlags
static const std::string optSubmitFlags
description: the name of the option for supplying extra submit parameters to batch systems rationale:...
Definition
Job.h:292
EL::Detail::ManagerStep::doResubmit
@ doResubmit
call the actual doResubmit method
Definition
ManagerStep.h:116
EL::Detail::ManagerStep::submitJob
@ submitJob
do the actual job submission
Definition
ManagerStep.h:92
EL::Detail::ManagerStep::batchScriptVar
@ batchScriptVar
create the variables needed for the batch-run script
Definition
ManagerStep.h:83
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition
AsgComponentFactories.h:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
RCU::Shell::quote
std::string quote(const std::string &name)
effects: quote the given name to protect it from the shell returns: the quoted name guarantee: strong...
Definition
ShellExec.cxx:65
index
Definition
index.py:1
file
TFile * file
Definition
tile_monitor.h:29
Generated on
for ATLAS Offline Software by
1.17.0