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 <TSystem.h>
21
#include <fstream>
22
#include <memory>
23
#include <sstream>
24
#include <cstdlib>
25
#include <filesystem>
26
27
//
28
// method implementations
29
//
30
31
ClassImp
(
EL::CondorDriver
)
32
33
namespace
EL
34
{
35
void
CondorDriver ::
36
testInvariant ()
const
37
{
38
RCU_INVARIANT
(
this
!= 0);
39
}
40
41
42
43
CondorDriver ::
44
CondorDriver ()
45
{
46
RCU_NEW_INVARIANT
(
this
);
47
}
48
49
50
51
::StatusCode
CondorDriver ::
52
doManagerStep (Detail::ManagerData& data)
const
53
{
54
RCU_READ_INVARIANT
(
this
);
55
using namespace
msgEventLoop;
56
ANA_CHECK
(
BatchDriver::doManagerStep
(data));
57
switch
(data.step)
58
{
59
case
Detail::ManagerStep::batchScriptVar
:
60
{
61
data.batchInit =
"export PATH LD_LIBRARY_PATH PYTHONPATH"
;
62
}
63
break
;
64
65
case
Detail::ManagerStep::submitJob
:
66
case
Detail::ManagerStep::doResubmit
:
67
{
68
// name of tarball being made (this needs to match BatchDriver.cxx)
69
const
std::string tarballName(
"AnalysisPackage.tar.gz"
);
70
71
if
(!data.resubmit)
72
{
73
if
(!data.options.castBool(
Job::optBatchSharedFileSystem
,
true
))
74
{
75
const
std::string newLocation = data.submitDir +
"/submit/"
+ tarballName;
76
int
status=gSystem->CopyFile(tarballName.c_str(),newLocation.c_str());
77
if
(status != 0)
78
{
79
ANA_MSG_ERROR
(
"failed to copy "
<< tarballName <<
" to "
<< newLocation);
80
return ::StatusCode::FAILURE;
81
}
82
}
83
}
84
85
{
86
std::ofstream
file
((data.submitDir +
"/submit/submit"
).c_str());
87
file
<<
"executable = run\n"
;
88
file
<<
"universe = vanilla\n"
;
89
file
<<
"log = submit/run.log\n"
;
90
file
<<
"output = submit/log-$(Item).out\n"
;
91
file
<<
"error = submit/log-$(Item).err\n"
;
92
file
<<
"initialdir = "
<< data.submitDir <<
"\n"
;
93
if
(!data.options.castBool(
Job::optBatchSharedFileSystem
,
true
))
94
{
// Transfer data with non-shared file-systems
95
file
<<
"should_transfer_files = YES\n"
;
96
file
<<
"when_to_transfer_output = ON_EXIT\n"
;
97
file
<<
"transfer_input_files = submit/"
<< tarballName <<
", submit/segments, submit/config.root\n"
;
98
file
<<
"transfer_output_files = fetch, status\n"
;
99
if
(
char
* x509userproxy = std::getenv(
"X509_USER_PROXY"
)) {
100
std::filesystem::path proxyPath(x509userproxy);
101
std::filesystem::path proxyPathDestination(data.submitDir +
"/submit/"
+ proxyPath.filename().string());
102
std::filesystem::copy(proxyPath,
103
proxyPathDestination,
104
std::filesystem::copy_options::overwrite_existing);
105
file
<<
"x509userproxy = "
<< proxyPathDestination.string() <<
"\n"
;
106
}
107
else
{
108
ANA_MSG_INFO
(
"X509_USER_PROXY not set"
);
109
}
110
}
111
file
<<
"arguments = $(Item)\n"
;
112
file
<<
"\n"
<< data.options.castString (
Job::optCondorConf
) <<
"\n"
;
113
file
<<
"queue in ( "
;
114
bool
first {
true
};
115
for
(std::size_t
index
: data.batchJobIndices)
116
{
117
if
(first)
118
first =
false
;
119
else
120
file
<<
", "
;
121
file
<<
index
;
122
}
123
file
<<
" )\n"
;
124
}
125
126
{
127
std::ostringstream cmd;
128
cmd <<
"cd "
<< data.submitDir <<
"/submit && condor_submit "
129
<< data.options.castString (
Job::optSubmitFlags
) <<
" submit"
;
130
if
(gSystem->Exec (cmd.str().c_str()) != 0)
131
{
132
ANA_MSG_ERROR
(
"failed to execute: "
<< cmd.str());
133
return ::StatusCode::FAILURE;
134
}
135
}
136
data.submitted =
true
;
137
}
138
break
;
139
140
default
:
141
break
;
142
}
143
return ::StatusCode::SUCCESS;
144
}
145
}
Assert.h
RCU_INVARIANT
#define RCU_INVARIANT(x)
Definition
Assert.h:189
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:31
CondorDriver.h
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:290
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
StatusCode.h
Job.h
ManagerData.h
MessageCheck.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::optBatchSharedFileSystem
static const std::string optBatchSharedFileSystem
description: batch-specific options rationale: these options are for configuring batch drivers
Definition
Job.h:508
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
index
Definition
index.py:1
file
TFile * file
Definition
tile_monitor.h:29
Generated on
for ATLAS Offline Software by
1.17.0