ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDTools
EventLoop
Root
SubmitManager.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
//
10
// includes
11
//
12
13
#include <
EventLoop/SubmitManager.h
>
14
15
#include <
AsgMessaging/StatusCode.h
>
16
#include <
EventLoop/Driver.h
>
17
#include <
EventLoop/Job.h
>
18
#include <
EventLoop/ManagerData.h
>
19
#include <
EventLoop/ManagerOrder.h
>
20
#include <
EventLoop/MessageCheck.h
>
21
#include <
EventLoop/MetricsSvc.h
>
22
#include <
RootCoreUtils/Assert.h
>
23
#include <
SampleHandler/Sample.h
>
24
#include <
SampleHandler/SampleHist.h
>
25
#include <TFile.h>
26
#include <TSystem.h>
27
#include <fstream>
28
29
using namespace
EL::msgEventLoop;
30
31
//
32
// method implementations
33
//
34
35
namespace
EL
36
{
37
namespace
Detail
38
{
39
std::pair<Detail::ManagerOrder,std::string> SubmitManager ::
40
getManagerOrder ()
const
noexcept
41
{
42
return
std::make_pair (
ManagerOrder::OPERATION
,
""
);
43
}
44
45
46
47
::StatusCode
SubmitManager ::
48
doManagerStep (
Detail::ManagerData
& data)
const
49
{
50
switch
(data.step)
51
{
52
case
Detail::ManagerStep::initial
:
53
{
54
if
(data.resubmit)
55
data.nextStep =
Detail::ManagerStep::initialResubmit
;
56
else
57
data.nextStep =
Detail::ManagerStep::initialSubmit
;
58
}
59
break
;
60
61
case
Detail::ManagerStep::fillOptions
:
62
{
63
data.options = *data.job->options();
64
data.options.fetchDefaults (*data.driver->options());
65
}
66
break
;
67
68
case
Detail::ManagerStep::addSystemAlgs
:
69
{
70
if
(data.options.castBool (
Job::optDisableMetrics
,
false
))
71
if
(!data.job->algsHas (
MetricsSvc::name
))
72
data.job->algsAdd (
new
MetricsSvc
);
73
}
74
break
;
75
76
case
Detail::ManagerStep::prepareSubmitDir
:
77
{
78
{
79
std::unique_ptr<TFile>
file
(TFile::Open ((data.submitDir +
"/driver.root"
).c_str(),
"RECREATE"
));
80
if
(
file
==
nullptr
||
file
->IsZombie())
81
{
82
ANA_MSG_ERROR
(
"failed to open "
<< data.submitDir <<
"/driver.root for writing"
);
83
return ::StatusCode::FAILURE;
84
}
85
file
->WriteObject (data.driver,
"driver"
);
86
file
->Close ();
87
}
88
data.job->sampleHandler().save (data.submitDir +
"/input"
);
89
{
90
std::ofstream
file
((data.submitDir +
"/location"
).c_str());
91
file
<< data.submitDir <<
"\n"
;
92
}
93
94
SH::SampleHandler
sh_hist;
95
for
(
SH::Sample
*sample : data.job->sampleHandler())
96
{
97
const
std::string histfile
98
= data.submitDir +
"/hist-"
+ sample->name() +
".root"
;
99
std::unique_ptr<SH::SampleHist> hist
100
(
new
SH::SampleHist
(sample->name(), histfile));
101
hist->meta()->fetch (*sample->meta());
102
sh_hist.
add
(std::move (hist));
103
}
104
sh_hist.
save
(data.submitDir +
"/hist"
);
105
}
106
break
;
107
108
case
Detail::ManagerStep::submitJob
:
109
{
110
ANA_MSG_INFO
(
"submitting job in "
<< data.submitDir);
111
}
112
break
;
113
114
case
Detail::ManagerStep::postSubmit
:
115
{
116
if
(!data.submitted)
117
{
118
ANA_MSG_FATAL
(
"Driver::submit not implemented in class "
<<
typeid
(*data.driver).name());
119
std::abort ();
120
}
121
122
ANA_MSG_DEBUG
(
"make submitted"
);
123
// this particular file can be checked to see if a job has
124
// been submitted successfully.
125
std::ofstream ((data.submitDir +
"/submitted"
).c_str());
126
}
127
break
;
128
129
case
Detail::ManagerStep::finalSubmit
:
130
{
131
data.nextStep =
Detail::ManagerStep::final
;
132
}
133
break
;
134
135
case
Detail::ManagerStep::finalResubmit
:
136
{
137
if
(!data.submitted)
138
{
139
ANA_MSG_FATAL
(
"Driver::resubmit not implemented in class "
<<
typeid
(*data.driver).name());
140
std::abort ();
141
}
142
143
data.nextStep =
Detail::ManagerStep::final
;
144
}
145
break
;
146
147
default
:
148
(void)
true
;
// safe to do nothing
149
}
150
return ::StatusCode::SUCCESS;
151
}
152
}
153
}
Assert.h
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg,...)
Macro printing error messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:295
ANA_MSG_DEBUG
#define ANA_MSG_DEBUG(xmsg,...)
Macro printing debug messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:289
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg,...)
Macro printing info messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:291
ANA_MSG_FATAL
#define ANA_MSG_FATAL(xmsg,...)
Macro printing fatal messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:297
StatusCode.h
Driver.h
Job.h
ManagerData.h
ManagerOrder.h
MetricsSvc.h
MessageCheck.h
SampleHist.h
Sample.h
SubmitManager.h
EL::Job::optDisableMetrics
static const std::string optDisableMetrics
description: the option to turn off collection of performance data
Definition
Job.h:409
EL::MetricsSvc
Definition
MetricsSvc.h:19
EL::MetricsSvc::name
static const std::string name
description: the name of the service
Definition
MetricsSvc.h:26
SH::SampleHandler
A class that manages a list of Sample objects.
Definition
SampleHandler.h:53
SH::SampleHandler::save
void save(const std::string &directory) const
save the list of samples to the given directory
SH::SampleHandler::add
void add(const Sample &sample)
add a copy of the sample to the handler
SH::SampleHist
A sample that represents a single histogram file.
Definition
SampleHist.h:23
SH::Sample
a base class that manages a set of files belonging to a particular data set and the associated meta-d...
Definition
Sample.h:49
const
EL::Detail
Definition
AsgComponentFactories.h:20
EL::Detail::ManagerStep::finalSubmit
@ finalSubmit
the final submit step
Definition
ManagerStep.h:101
EL::Detail::ManagerStep::final
@ final
Definition
ManagerStep.h:136
EL::Detail::ManagerStep::finalResubmit
@ finalResubmit
the final resubmit step
Definition
ManagerStep.h:119
EL::Detail::ManagerStep::submitJob
@ submitJob
do the actual job submission
Definition
ManagerStep.h:92
EL::Detail::ManagerStep::addSystemAlgs
@ addSystemAlgs
add any system algorithms to the job that may need to get added
Definition
ManagerStep.h:71
EL::Detail::ManagerStep::fillOptions
@ fillOptions
in this step we fill the options structure, combining the different locations from which we can pull ...
Definition
ManagerStep.h:56
EL::Detail::ManagerStep::initial
@ initial
this is just the initial step we do, nothing really happens here
Definition
ManagerStep.h:45
EL::Detail::ManagerStep::prepareSubmitDir
@ prepareSubmitDir
prepare files in our submission directory
Definition
ManagerStep.h:74
EL::Detail::ManagerStep::postSubmit
@ postSubmit
do whatever needs to be done after the submission is done
Definition
ManagerStep.h:98
EL::Detail::ManagerStep::initialSubmit
@ initialSubmit
the initial submit step
Definition
ManagerStep.h:48
EL::Detail::ManagerStep::initialResubmit
@ initialResubmit
the initial resubmit step
Definition
ManagerStep.h:104
EL::Detail::ManagerOrder::OPERATION
@ OPERATION
the base-operation performed (e.g. submit, retrieve)
Definition
ManagerOrder.h:35
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
EL::Detail::ManagerData
an internal data structure for passing data between different manager objects anbd step
Definition
ManagerData.h:46
file
TFile * file
Definition
tile_monitor.h:29
Generated on
for ATLAS Offline Software by
1.17.0