EWP-BplusToKstMuMu-AngAna/Code/FCNCFitter/runUtils.py

30 lines
967 B
Python

# Renata Kopecna
import subprocess
def parse_jobID(opts):
job_list = []
if (opts.Data): job_list.append(0)
if (opts.MC): job_list.append(1)
if (opts.RefMC): job_list.append(2)
if (opts.PHSP): job_list.append(3)
if (opts.genMC):
if (opts.boost): job_list.append(5)
else: job_list.append(4)
return job_list
def waitForCommand(cmd, args, logFile): #args is a list
if (type(cmd) is not str):
raise TypeError("waitForCommand needs (str,list,str). Got ("+str(type(args))+",list,str) instead.")
if (type(args) is not list):
raise TypeError("waitForCommand needs (str,list,str). Got (str," +type(args)+",str) instead.")
if (logFile.name=="dummy"):
p = subprocess.run([cmd]+args, cwd = "./", check = True) #Output into console
else:
p = subprocess.run([cmd]+args, stdout=logFile, cwd = "./", check = True) #Output into a logFile
print ("Return:", p.returncode)