38def finalizeJobs(dryRun):
39
40
41 dagfile = ""
42 for job in joblist:
43 dagfile += "JOB "+job.id+" "+job.basedir+"/"+job.name+".sub\n"
44
45 for parent,children in dependencelist.items():
46 dagfile += "PARENT "+parent+" CHILD"
47 for child in children:
48 dagfile += " "+child
49 dagfile += "\n"
50
51
52 with open("dagfile.dag", 'w') as f:
53 f.write(dagfile)
54
55
56 batchname = os.path.basename(os.path.normpath(os.getcwd()))
57 cmd = "condor_submit_dag -force -batch-name "+batchname+" dagfile.dag"
58
59 if dryRun:
60 print (cmd+"\n")
61 print ("dagfile: \n"+dagfile)
62 else:
63 print (cmd)
64 p = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
65 retcode = p.communicate()
66 if len(retcode[0]):
67 print (retcode[0])
68 if len(retcode[1]):
69 print (retcode[1])
70 if p.returncode:
71 print ("ERROR: error while submitting job")
72 print ("return code: " + str(p.returncode))
73 sys.exit(11)
74