diff --git a/CondorHelper.py b/CondorHelper.py new file mode 100644 index 0000000..3da7120 --- /dev/null +++ b/CondorHelper.py @@ -0,0 +1,42 @@ +import subprocess +from optparse import OptionParser +import time + + +parser = OptionParser() + +parser.add_option('-r', '--runscript', metavar='FILE', type='string', action='store', + default = '', + dest = 'runscript', + help = 'Run template to use') +parser.add_option('-i', '--inputs', metavar='FILE', type='string', action='store', + default = '', + dest = 'inputs', + help = 'Inputs to send along') +parser.add_option('-a', '--args', metavar='FILE', type='string', action='store', + default = '', + dest = 'args', + help = 'Text file with python arguments') + + +(options, args) = parser.parse_args() + +commands = [] + +print(options.args) + +# Tar stuff +if options.inputs != '': + commands.append("tar czvf tarball.tgz "+options.inputs) + +# Make JDL from template +timestr = time.strftime("%Y%m%d-%H%M%S") +out_jdl = 'temp_'+timestr+'_jdl' +commands.append("sed 's$TEMPSCRIPT$"+options.runscript+"$g' $CMSSW_BASE/src/BstarToTW_CMSDAS2020/condor/templates/jdl_template > "+out_jdl) +commands.append("sed -i 's$TEMPARGS$"+options.args+"$g' "+out_jdl) +commands.append("condor_submit "+out_jdl+" -debugfile condor_submit_debug.log") +commands.append("mv "+out_jdl+" condor/logs/") + +for s in commands: + print(s) + subprocess.call([s],shell=True) diff --git a/README.md b/README.md index 00d91eb..7ae1f3f 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ### Setup CMSSW environment: ``` ssh -XY USERNAME@cmslpc-sl7.fnal.gov -cexport $SCRAM_ARCH=slc7_amd64_gcc820 +export $SCRAM_ARCH=slc7_amd64_gcc820 cd nobackup/ mkdir b2g_exercise/ cd b2g_exercise/ @@ -52,3 +52,15 @@ cd ../BstarToTW_CMSDAS2020 git fetch --all git pull origin master ``` + +## Submitting jobs + +Testing one +``` +python CondorHelper.py -r condor/run_bstar.sh -a test_args.txt -i "bs_select.py bstar.cc bstar_config.json helpers.py" +``` + +For 2016: +``` +python CondorHelper.py -r condor/run_bstar.sh -a all_args.txt -i "bs_select.py bstar.cc bstar_config.json helpers.py" +``` \ No newline at end of file