############################################ # a submitter for ReweighterBTagShape_test # ############################################ import sys import os sys.path.append('../../jobSubmission') import condorTools as ct if __name__ == '__main__': inputfile = os.path.abspath(sys.argv[1]) nevents = sys.argv[2] exe = './run2ulReweighter_test' if not os.path.exists(inputfile): raise Exception('ERROR: input file does not exist.') if not os.path.exists(exe): raise Exception('ERROR: executable does not exist.') (inputdir, inputfile) = os.path.split(inputfile) command = '{} {} {} {}'.format(exe, inputdir, inputfile, nevents) ct.submitCommandAsCondorJob('cjob_run2ulReweighter_test', command)
from jobSettings import CMSSW_VERSION def some_task(): ### perform a basic task that takes some time print('###starting###') for i in range(5): ctime = datetime.datetime.now().strftime('%H:%M:%S') print('Current time: {}'.format(ctime)) time.sleep(5) print('###done###') if __name__=='__main__': nargs = len(sys.argv) if nargs==1: cmd = 'python submitCondorTestJob.py local' ct.submitCommandAsCondorJob('cjob_submitCondorTestJob', cmd, cmssw_version=CMSSW_VERSION) elif nargs==2: if sys.argv[1]=='local': some_task() else: raise Exception('ERROR: argument not recognized:' +' {}'.format(sys.argv[1])) else: raise Exception('ERROR: unrecognized number of arguments:' +' {} ({})'.format(sys.argv,nargs))
############################################ # a submitter for ReweighterBTagShape_test # ############################################ import sys import os sys.path.append('../../jobSubmission') import condorTools as ct if __name__ == '__main__': inputfile = os.path.abspath(sys.argv[1]) nevents = sys.argv[2] exe = './ReweighterBTagShape_test' if not os.path.exists(inputfile): raise Exception('ERROR: input file does not exist.') if not os.path.exists(exe): raise Exception('ERROR: executable does not exist.') (inputdir, inputfile) = os.path.split(inputfile) command = '{} {} {} {}'.format(exe, inputdir, inputfile, nevents) ct.submitCommandAsCondorJob('cjob_ReweighterBTagShape_test', command)
raise Exception('ERROR: input file {} does not exist'.format(f)) # check if target file exists if os.path.exists(targetfile): raise Exception( 'ERROR: target file {} already exist,'.format(targetfile) + ' please remove it manually before recreating') # check if executable exists if not os.path.exists(exe): raise Exception('ERROR: executable {} does not exist'.format(exe)) # print and ask for confirmation print('will merge the following files:') for f in inputfiles: print('- {}'.format(f)) print('into the target file {}'.format(targetfile)) print('continue? (y/n)') go = raw_input() if go != 'y': sys.exit() # make the command cmd = '{} {}'.format(exe, targetfile) for f in inputfiles: cmd += ' {}'.format(f) # submit the command ct.submitCommandAsCondorJob('cjob_mergeDataSets', cmd, cmssw_version=CMSSW_VERSION)
sys.exit() targetfile = sys.argv[1] inputfiles = sys.argv[2:] exe = 'hadd' # check if input files exist for f in inputfiles: if not os.path.exists(f): raise Exception('ERROR: input file {} does not exist'.format(f)) # check if target file exists if os.path.exists(targetfile): raise Exception('ERROR: target file {} already exist,'.format(targetfile) +' please remove it manually before recreating') # print and ask for confirmation print('will merge the following files using {}:'.format(exe)) for f in inputfiles: print('- {}'.format(f)) print('into the target file {}'.format(targetfile)) print('continue? (y/n)') go = raw_input() if go != 'y': sys.exit() # make the command cmd = '{} {}'.format(exe,targetfile) for f in inputfiles: cmd += ' {}'.format(f) # submit the command ct.submitCommandAsCondorJob( 'cjob_mergeHadd', cmd )
for f in inputfiles: if not os.path.exists(f): raise Exception('ERROR: input file {} does not exist'.format(f)) # check if target file exists if os.path.exists(targetfile): raise Exception( 'ERROR: target file {} already exist,'.format(targetfile) + ' please remove it manually before recreating') # check if executable exists if not os.path.exists(exe): raise Exception('ERROR: executable {} does not exist'.format(exe)) # print and ask for confirmation print('will merge the following files:') for f in inputfiles: print('- {}'.format(f)) print('into the target file {}'.format(targetfile)) print('continue? (y/n)') go = raw_input() if go != 'y': sys.exit() # make the command cmd = '{} {}'.format(exe, targetfile) for f in inputfiles: cmd += ' {}'.format(f) # submit the command ct.submitCommandAsCondorJob('cjob_mergeDataSets', cmd)