ATLAS Offline Software
Loading...
Searching...
No Matches
slurm_taurus.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3import subprocess,sys,os
4
6 for line in open("qsub.log"):
7 pass
8 parts = line.split(" ")
9 return parts[3].split("\n")[0]
10
11from . import batchJobBase
12
14
15 def submit(self, dryRun=False):
16 cpt = 1
17 if self.memMB == 1499:
18 self.memMB = 1970
19 elif self.memMB == 2499:
20 #ram = 5250
21 self.memMB = 2583
22 cpt = 2
23 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 haswell,romeo --cpus-per-task="+str(cpt)+" -N 1 --ntasks "+str(self.nCores)
24 if os.environ.get('SLURM_MAIL_USER'):
25 cmd += " --mail-type='END,FAIL,TIME_LIMIT' --mail-user='"+os.environ.get('SLURM_MAIL_USER')+"'"
26
27 if len(self.dependsOnOk)>0 or len(self.dependsOnAny)>0:
28 cmd += " -d "
29 if len(self.dependsOnOk)>0:
30 okdeps = "afterok:"+",afterok:".join(self.dependsOnOk)
31 cmd += okdeps+","
32 if len(self.dependsOnAny)>0:
33 anydeps = "afterany:"+",afterany:".join(self.dependsOnAny)
34 cmd += anydeps+","
35 cmd = cmd[:-1]
36
37 if "ecm" in self.basedir:
38 jobname = os.path.relpath(self.basedir+"/"+self.name+".log", self.basedir+"/../..")
39 else:
40 jobname = os.path.relpath(self.basedir+"/"+self.name+".log", self.basedir+"/..")
41 cmd += " -J "+jobname+" "+self.basedir+"/"+self.name+".sh >> qsub.log \n"
42
43 if dryRun:
44 print (cmd)
45 self.id = "-1"
46 else:
47 print(cmd)
48 p = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
49 retcode = p.communicate()
50 if len(retcode[0]):
51 print (retcode[0])
52 if len(retcode[1]):
53 print (retcode[1])
54 if p.returncode:
55 print ("ERROR: error while submitting job")
56 print ("return code: " + str(p.returncode))
57 sys.exit(11)
58
59 p.wait()
60
61 self.id = getJobIDfromlastJob()
62
63 print("Submitted "+str(self.id)+" ("+self.name+")\n\n")
64
65def finalizeJobs(dryRun):
66 return True
67
void print(char *figname, TCanvas *c1)
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177