ATLAS Offline Software
Generators
Sherpa_i
python
sherpaTarCreator
slurm_barnard.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3
import
subprocess,sys,os
4
5
def
getJobIDfromlastJob
():
6
for
line
in
open
(
"qsub.log"
):
7
pass
8
parts = line.split(
" "
)
9
return
parts[3].
split
(
"\n"
)[0]
10
11
from
.
import
batchJobBase
12
13
class
batchJob
(
batchJobBase.batchJobBase
):
14
15
def
submit
(self, dryRun=False):
16
cpt = 1
17
if
self.
memMB
== 1499
or
self.
memMB
== 2499:
18
self.
memMB
= 4800
19
cmd =
"sbatch -e "
+self.
basedir
+
"/"
+self.
name
+
".log -o "
+self.
basedir
+
"/"
+self.
name
+
".log --time="
+
str
(self.
hours
)+
":00:00 --mem-per-cpu="
+
str
(self.
memMB
)+
" -p barnard --cpus-per-task="
+
str
(cpt)+
" -N 1 --ntasks "
+
str
(self.
nCores
)
20
if
os.environ.get(
'SLURM_MAIL_USER'
):
21
cmd +=
" --mail-type='END,FAIL,TIME_LIMIT' --mail-user='"
+os.environ.get(
'SLURM_MAIL_USER'
)+
"'"
22
23
if
len(self.
dependsOnOk
)>0
or
len(self.
dependsOnAny
)>0:
24
cmd +=
" -d "
25
if
len(self.
dependsOnOk
)>0:
26
okdeps =
"afterok:"
+
",afterok:"
.
join
(self.
dependsOnOk
)
27
cmd += okdeps+
","
28
if
len(self.
dependsOnAny
)>0:
29
anydeps =
"afterany:"
+
",afterany:"
.
join
(self.
dependsOnAny
)
30
cmd += anydeps+
","
31
cmd = cmd[:-1]
32
33
if
"ecm"
in
self.
basedir
:
34
jobname = os.path.relpath(self.
basedir
+
"/"
+self.
name
+
".log"
, self.
basedir
+
"/../.."
)
35
else
:
36
jobname = os.path.relpath(self.
basedir
+
"/"
+self.
name
+
".log"
, self.
basedir
+
"/.."
)
37
cmd +=
" -J "
+jobname+
" "
+self.
basedir
+
"/"
+self.
name
+
".sh >> qsub.log \n"
38
39
if
dryRun:
40
print
(cmd)
41
self.
id
=
"-1"
42
else
:
43
print
(cmd)
44
p = subprocess.Popen(cmd,shell=
True
,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
45
retcode = p.communicate()
46
if
len(retcode[0]):
47
print
(retcode[0])
48
if
len(retcode[1]):
49
print
(retcode[1])
50
if
p.returncode:
51
print
(
"ERROR: error while submitting job"
)
52
print
(
"return code: "
+
str
(p.returncode))
53
sys.exit(11)
54
55
p.wait()
56
57
self.
id
=
getJobIDfromlastJob
()
58
59
print
(
"Submitted "
+
str
(self.
id
)+
" ("
+self.
name
+
")\n\n"
)
60
61
def
finalizeJobs
(dryRun):
62
return
True
63
sherpaTarCreator.batchJobBase.batchJobBase.name
name
Definition:
batchJobBase.py:9
sherpaTarCreator.batchJobBase.batchJobBase.memMB
memMB
Definition:
batchJobBase.py:13
sherpaTarCreator.batchJobBase.batchJobBase.basedir
basedir
Definition:
batchJobBase.py:19
sherpaTarCreator.batchJobBase.batchJobBase.id
id
Definition:
batchJobBase.py:20
sherpaTarCreator.slurm_barnard.finalizeJobs
def finalizeJobs(dryRun)
Definition:
slurm_barnard.py:61
sherpaTarCreator.slurm_barnard.batchJob
Definition:
slurm_barnard.py:13
sherpaTarCreator.batchJobBase.batchJobBase
Definition:
batchJobBase.py:5
sherpaTarCreator.batchJobBase.batchJobBase.hours
hours
Definition:
batchJobBase.py:11
sherpaTarCreator.slurm_barnard.getJobIDfromlastJob
def getJobIDfromlastJob()
Definition:
slurm_barnard.py:5
sherpaTarCreator.batchJobBase.batchJobBase.nCores
nCores
Definition:
batchJobBase.py:12
sherpaTarCreator.slurm_barnard.batchJob.submit
def submit(self, dryRun=False)
Definition:
slurm_barnard.py:15
print
void print(char *figname, TCanvas *c1)
Definition:
TRTCalib_StrawStatusPlots.cxx:25
sherpaTarCreator.batchJobBase.batchJobBase.dependsOnOk
dependsOnOk
Definition:
batchJobBase.py:21
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition:
Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
Trk::open
@ open
Definition:
BinningType.h:40
sherpaTarCreator.batchJobBase.batchJobBase.dependsOnAny
dependsOnAny
Definition:
batchJobBase.py:22
str
Definition:
BTagTrackIpAccessor.cxx:11
Trk::split
@ split
Definition:
LayerMaterialProperties.h:38
Generated on Wed Jan 8 2025 21:17:23 for ATLAS Offline Software by
1.8.18