ATLAS Offline Software
Loading...
Searching...
No Matches
htcondor_baf.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3import os
4
5joblist = []
6dependencelist = {} #"id":["childid"]
7
8from . import batchJobBase
9
11
12 def submit(self, dryRun=False):
13 if self.memMB == 1:
14 self.memMB = 2000
15 elif self.memMB == 2:
16 self.memMB = 6000
17
18 self.id=self.name+".sh"
19 self.id = self.id.replace(".","-")
20
21 joblist.append(self)
22 for parentid in self.dependsOnOk+self.dependsOnAny:
23 dependencelist.setdefault(parentid, []).append(self.id)
24
25 #create submit file
26 submitfile = ""
27 submitfile += "executable = "+self.basedir+"/"+self.name+".sh\n"
28 submitfile += "output = "+self.basedir+"/"+self.name+".log\n"
29 submitfile += "error = "+self.basedir+"/"+self.name+".log\n"
30 submitfile += "log = outHTC.log\n"
31 submitfile += "+ContainerOS = \"Rocky9\"\n"
32 submitfile += "+CephFS_IO = \"low\"\n"
33 submitfile += "+MaxRuntimeHours = "+str(int(self.hours))+"\n"
34 submitfile += "RequestCpus = "+str(max(self.nCores,int(self.memMB/2000.)))+"\n"
35 submitfile += "queue\n"
36 with open(self.basedir+"/"+self.name+".sub", 'w') as f:
37 f.write(submitfile)
38 print("Created "+str(self.id)+" ("+self.basedir+"/"+self.name+".sub")
39
40def finalizeJobs(dryRun):
41
42 #create dagfile
43 dagfile = ""
44 for job in joblist:
45 dagfile += "JOB "+job.id+" "+job.basedir+"/"+job.name+".sub\n"
46
47 for parent,children in dependencelist.items():
48 dagfile += "PARENT "+parent+" CHILD"
49 for child in children:
50 dagfile += " "+child
51 dagfile += "\n"
52
53 #save file
54 with open("dagfile.dag", 'w') as f:
55 f.write(dagfile)
56
57 #submit job
58 batchname = os.path.basename(os.path.normpath(os.getcwd()))
59 cmd = "condor_submit_dag -force -batch-name "+batchname+" dagfile.dag"
60
61 if dryRun:
62 print ("Submission command:", cmd+"\n")
63 print ("dagfile: \n"+dagfile)
64
void print(char *figname, TCanvas *c1)
#define max(a, b)
Definition cfImp.cxx:41
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:310