Skip to content

Instantly share code, notes, and snippets.

@rocarvaj
Created September 23, 2012 12:03
Show Gist options
  • Save rocarvaj/3770119 to your computer and use it in GitHub Desktop.
Save rocarvaj/3770119 to your computer and use it in GitHub Desktop.
Submit multiple jobs to Condor
#!/bin/bash
########################################################
# This script generates multiples .cmd (Condor) files,
# one for each instance in the input file instances.txt.
# You can easily change this to have different arguments
# in the input file.
#
# After you have generated the file, use the multiSubmit.sh
# script to submit all your jobs at once.
#
#
# Rodolfo Carvajal 2012 bit.ly/rocarvaj
########################################################
i=0
for f in `cat Cfiles.txt`
do
cat > Runner${i}.cmd << EOF
################################
##
## Condor file for instance ${f}
##
################################
universe = vanilla
executable = /path/to/my/executable
# I've turned off notifications. Specially since you'll be running a batch of jobs
notification = never
# Name of the instance, obtained from the input file
PROBLEM_FILE = ${f}
# Arguments. Here you can define the arguments that your executable receives
ARG1 = 0
ARG2 = 3600
ARG3 = 1
ARG4 = 1 27 28 29 30 31 32 33 34 35 36 37
ARG5 = 1 1 1 1 1 1 1 1 1 1 1 1
# This is a name for this set of runs. It will be in the name of the log files
# and also is the name of a folder (you have to create it) that will contains the out/log files.
RUN_NAME = ANewFeature
# Note that the output and error files are the same here
output = \$(SPEC_NAME)/\$(PROBLEM_FILE)_\$(SPEC_NAME).out
error = \$(SPEC_NAME)/\$(PROBLEM_FILE)_\$(SPEC_NAME).out
log = \$(SPEC_NAME)/\$(PROBLEM_FILE)_\$(SPEC_NAME).log
arguments = \$(EXEC) \$(PROBLEM_FILE) \$(ARG1) \$(ARG2) \$(ARG3) \$(ARG4) \$(ARG5)
queue
EOF
let "i = ${i} + 1"
done
#!/bin/bash
####################################################
# This script submits a range of the files generated
# by CMDMaker.sh.
#
# Usage: ./multiSubmit.sh init end
#
# Where init and end are the indices of the range of
# files to submit
#
# Rodolfo Carvajal 2012 bit.ly/rocarvaj
####################################################
for i in `seq $1 $2`
do
condor_submit "Runner$i.cmd"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment