Skip to content

Commit

Permalink
add condor helper
Browse files Browse the repository at this point in the history
  • Loading branch information
cmantill committed Jan 14, 2021
1 parent d41b500 commit ed89072
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
42 changes: 42 additions & 0 deletions CondorHelper.py
Original file line number Diff line number Diff line change
@@ -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)
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### Setup CMSSW environment:
```
ssh -XY [email protected]
cexport $SCRAM_ARCH=slc7_amd64_gcc820
export $SCRAM_ARCH=slc7_amd64_gcc820
cd nobackup/
mkdir b2g_exercise/
cd b2g_exercise/
Expand Down Expand Up @@ -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"
```

0 comments on commit ed89072

Please sign in to comment.