ATLAS Offline Software
Generators
Sherpa_i
python
sherpaTarCreator
pbs_lcrc_improv.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
from
.
import
batchJobBase
6
7
def
getJobIDfromlastJob
():
8
last =
None
9
with
open
(
"qsub.log"
)
as
f:
10
for
line
in
f:
11
if
line.strip():
12
last = line
13
if
last
is
None
:
14
raise
ValueError(
"log is empty or only blank lines"
)
15
return
last
16
17
class
batchJob
(
batchJobBase.batchJobBase
):
18
19
def
submit
(self, dryRun=False):
20
21
cmd =
"qsub -j oe -o "
+self.
basedir
+
"/"
+self.
name
+
".log -l walltime="
+
str
(self.
hours
)+
":00:00,select=1:ncpus="
+
str
(self.
nCores
)+
" -A "
+self.
account
+
" -q "
+self.
queue
22
23
if
len(self.
dependsOnOk
)>0
or
len(self.
dependsOnAny
)>0:
24
cmd +=
" -W depend="
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].rstrip()
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
jobname = jobname.replace(
'.'
,
'_'
).
replace
(
'/'
,
'_'
)
38
cmd +=
" -N "
+jobname+
" "
+self.
basedir
+
"/"
+self.
name
+
".sh >> qsub.log \n"
39
40
if
dryRun:
41
print
(cmd)
42
self.
id
=
"-1"
43
else
:
44
print
(cmd)
45
p = subprocess.Popen(cmd,shell=
True
,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
46
retcode = p.communicate()
47
if
len(retcode[0]):
48
print
(retcode[0])
49
if
len(retcode[1]):
50
print
(retcode[1])
51
if
p.returncode:
52
print
(
"ERROR: error while submitting job"
)
53
print
(
"return code: "
+
str
(p.returncode))
54
sys.exit(11)
55
56
p.wait()
57
58
self.
id
=
getJobIDfromlastJob
()
59
60
print
(
"Submitted "
+self.
name
+
" with id: "
+self.
id
+
"\n\n"
)
61
62
def
finalizeJobs
(dryRun):
63
return
True
64
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition:
hcg.cxx:307
sherpaTarCreator.batchJobBase.batchJobBase.name
name
Definition:
batchJobBase.py:9
sherpaTarCreator.batchJobBase.batchJobBase.basedir
basedir
Definition:
batchJobBase.py:22
sherpaTarCreator.batchJobBase.batchJobBase.queue
queue
Definition:
batchJobBase.py:14
sherpaTarCreator.batchJobBase.batchJobBase.id
id
Definition:
batchJobBase.py:23
sherpaTarCreator.batchJobBase.batchJobBase.account
account
Definition:
batchJobBase.py:13
sherpaTarCreator.pbs_lcrc_improv.finalizeJobs
def finalizeJobs(dryRun)
Definition:
pbs_lcrc_improv.py:62
sherpaTarCreator.batchJobBase.batchJobBase
Definition:
batchJobBase.py:5
sherpaTarCreator.batchJobBase.batchJobBase.hours
hours
Definition:
batchJobBase.py:11
sherpaTarCreator.pbs_lcrc_improv.getJobIDfromlastJob
def getJobIDfromlastJob()
Definition:
pbs_lcrc_improv.py:7
sherpaTarCreator.batchJobBase.batchJobBase.nCores
nCores
Definition:
batchJobBase.py:12
print
void print(char *figname, TCanvas *c1)
Definition:
TRTCalib_StrawStatusPlots.cxx:25
sherpaTarCreator.batchJobBase.batchJobBase.dependsOnOk
dependsOnOk
Definition:
batchJobBase.py:24
sherpaTarCreator.pbs_lcrc_improv.batchJob.submit
def submit(self, dryRun=False)
Definition:
pbs_lcrc_improv.py:19
sherpaTarCreator.pbs_lcrc_improv.batchJob
Definition:
pbs_lcrc_improv.py:17
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:25
str
Definition:
BTagTrackIpAccessor.cxx:11
Generated on Tue Sep 2 2025 21:18:22 for ATLAS Offline Software by
1.8.18