How to Create multiple Condor jobs

by raulzito234

If you want to know how to create a single condor job, please follow this post.

My code runs matlab code. To run many jobs I created a script that creates a script per job the name of the script of each single job is matlab.sh.  The following script creates such a script:

#!/bin/sh

bashstring="#!/bin/sh"
prefix="matlab -nodisplay -nodesktop -nosplash -nojvm -r \"SimilarityMeasureWithInput('"
sufix="')\""
FILES=./Fragments/Training/*
for f in $FILES
do
 echo $bashstring$'\n'$prefix$f$sufix >> matlab.sh
 chmod u+x matlab.sh
 condor_submit mat.submit
 rm matlab.sh
done

The above code checks all files under the directory ./Fragments/Training and loops through them, it then prints the content of the concatenated string $bashstring$’\n’$prefix$f$sufix to the file matlab.sh. For example a script file matlab.sh will look like this:


#!/bin/sh

matlab -nodisplay -nodesktop -nosplash -nojvm -r "SimilarityMeasureWithInput('./Fragments/Training/14_2_1.jpg')"

It makes the script file runnable by the user with the command chmod and then submits the job. The submit file is named mat.submit in this case, but it can be named anything. Don’t forget to create the submit file.

Advertisements