Definition at line 13 of file slurm_barnard.py.
◆ submit()
def sherpaTarCreator.slurm_barnard.batchJob.submit |
( |
|
self, |
|
|
|
dryRun = False |
|
) |
| |
Definition at line 15 of file slurm_barnard.py.
15 def submit(self, dryRun=False):
17 if self.memMB == 1499
or self.memMB == 2499:
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')+
"'"
23 if len(self.dependsOnOk)>0
or len(self.dependsOnAny)>0:
25 if len(self.dependsOnOk)>0:
26 okdeps =
"afterok:"+
",afterok:".
join(self.dependsOnOk)
28 if len(self.dependsOnAny)>0:
29 anydeps =
"afterany:"+
",afterany:".
join(self.dependsOnAny)
33 if "ecm" in self.basedir:
34 jobname = os.path.relpath(self.basedir+
"/"+self.name+
".log", self.basedir+
"/../..")
36 jobname = os.path.relpath(self.basedir+
"/"+self.name+
".log", self.basedir+
"/..")
37 cmd +=
" -J "+jobname+
" "+self.basedir+
"/"+self.name+
".sh >> qsub.log \n"
44 p = subprocess.Popen(cmd,shell=
True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
45 retcode = p.communicate()
51 print (
"ERROR: error while submitting job")
52 print (
"return code: " +
str(p.returncode))
59 print(
"Submitted "+
str(self.id)+
" ("+self.name+
")\n\n")
◆ write()
def sherpaTarCreator.batchJobBase.batchJobBase.write |
( |
|
self, |
|
|
|
useSingularity = True , |
|
|
|
useApptainer = False , |
|
|
|
extraDirs = [] |
|
) |
| |
|
inherited |
Definition at line 27 of file batchJobBase.py.
27 def write(self, useSingularity=True, useApptainer=False, extraDirs=[]):
28 executable =
"#!/bin/sh -\n"
32 platform =
str(os.environ[
'COMPILER_PATH']).
split(
'/')[-1].
replace(
'el9',
'almalinux9')
33 executable +=
'if [ "$1" != "--really" ]; then \n'
34 executable +=
' exec singularity exec -e --no-home'
35 for dir
in [
"/cvmfs",
"/var", self.basedir,
"$(pwd | cut -d '/' -f 1-2)"] + extraDirs:
36 executable +=
' -B '+dir
37 executable +=
' /cvmfs/atlas.cern.ch/repo/containers/fs/singularity/'
38 executable += platform +
' /bin/bash -- "$0" --really "$@";\n'
40 executable +=
"shift;\n\n"
41 executable +=
"export ATLAS_LOCAL_ROOT_BASE=/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase\n"
42 executable +=
"source ${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.sh\n"
46 wrapperfilename = self.basedir+
"/"+self.name+
"_wrapper.sh"
47 platform =
str(os.environ[
'COMPILER_PATH']).
split(
'/')[-1].
replace(
'el9',
'almalinux9')
48 executable +=
'export ALRB_CONT_SWTYPE="apptainer"\n'
49 executable +=
'export ALRB_CONT_PRESETUP="hostname -f; date; id -a"\n'
50 executable +=
'export ALRB_testPath=",,,,,,,,,,,,,,,,,,,,,,,,"\n'
51 executable +=
'export ALRB_CONT_RUNPAYLOAD="'+wrapperfilename+
'"\n'
52 wrapper +=
"ulimit -f 1000000;\n"
53 wrapper +=
"cd "+self.basedir+
";\n\n"
54 wrapper +=
"echo 'ncores="+
str(self.nCores)+
" nhours="+
str(self.hours)+
" "+self.basedir+
"/"+self.name+
".sh';\n"
57 with open(wrapperfilename,
'w')
as f:
59 st = os.stat(wrapperfilename)
60 os.chmod(wrapperfilename, st.st_mode | stat.S_IEXEC)
61 executable +=
"export ATLAS_LOCAL_ROOT_BASE=/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase\n"
62 executable +=
"source ${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.sh -c "+platform+
" -b -q"
64 executable +=
"-m"+
" ".
join(self.mounts)
67 executable +=
"exit $?\n"
70 executable +=
"ulimit -f 1000000;\n"
71 executable +=
"cd "+self.basedir+
"\n\n"
72 executable +=
"echo 'ncores="+
str(self.nCores)+
" nhours="+
str(self.hours)+
" "+self.basedir+
"/"+self.name+
".sh';\n"
74 executable += cmd+
"\n"
75 executable +=
"exit 0\n"
77 filename = self.basedir+
"/"+self.name+
".sh"
78 with open(filename,
'w')
as f:
82 st = os.stat(filename)
83 os.chmod(filename, st.st_mode | stat.S_IEXEC)
◆ account
sherpaTarCreator.batchJobBase.batchJobBase.account |
|
inherited |
◆ basedir
sherpaTarCreator.batchJobBase.batchJobBase.basedir |
|
inherited |
◆ cmds
sherpaTarCreator.batchJobBase.batchJobBase.cmds |
|
inherited |
◆ dependsOnAny
sherpaTarCreator.batchJobBase.batchJobBase.dependsOnAny |
|
inherited |
◆ dependsOnOk
sherpaTarCreator.batchJobBase.batchJobBase.dependsOnOk |
|
inherited |
◆ env
sherpaTarCreator.batchJobBase.batchJobBase.env |
|
inherited |
◆ hours
sherpaTarCreator.batchJobBase.batchJobBase.hours |
|
inherited |
◆ id
sherpaTarCreator.slurm_barnard.batchJob.id |
◆ memMB
sherpaTarCreator.slurm_barnard.batchJob.memMB |
◆ mounts
sherpaTarCreator.batchJobBase.batchJobBase.mounts |
|
inherited |
◆ name
sherpaTarCreator.batchJobBase.batchJobBase.name |
|
inherited |
◆ nCores
sherpaTarCreator.batchJobBase.batchJobBase.nCores |
|
inherited |
◆ queue
sherpaTarCreator.batchJobBase.batchJobBase.queue |
|
inherited |
The documentation for this class was generated from the following file: