Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:41:48

0001 import subprocess
0002 import sys
0003 import os
0004 def submit(dataset, run, out_files):
0005     cfg=""
0006     with open("crabConfig.py","r") as f:
0007         cfg=f.readlines()
0008         cfg[0]="runNumber = \'"+str(run)+'\'\n'
0009         cfg[1]="dataset = "+'\"'+str(dataset)+'\"\n'
0010         cfg[2]="out_files = "+str(out_files)+'\n'
0011         
0012     with open("crabConfig.py","w") as f:
0013         f.writelines(cfg)
0014             
0015         
0016     subprocess.run(["crab", "submit", "-c", "crabConfig.py"],stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
0017 
0018 
0019 
0020 
0021 out_files=[]
0022 submit_child=os.fork()
0023 run_range=''
0024 if(submit_child==0):
0025     if sys.argv[2]=="range":
0026         for run in range(int(sys.argv[3]),int(sys.argv[4])+1):
0027             out_files.append('DQM_V0001_CTPPS_R000'+str(run)+'.root')
0028         run_range=sys.argv[3]+'-'+sys.argv[4]
0029     else:
0030         for run in sys.argv[2:]:
0031             out_files.append('DQM_V0001_CTPPS_R000'+str(run)+'.root')
0032         run_range=sys.argv[2]+'-'+sys.argv[-1]
0033         
0034     submit(sys.argv[1], run_range, out_files)
0035         
0036 else:
0037     print("submission process detached")
0038