Page History

Turn Off History

You might want to submit a job repeatedly, varying the arguments for each run. The core technique is to queue multiple jobs in a single submit file, using submit macros and ClassAd expressions to calculate the argument.

Monotonically increasing count

You can use $(Process) in your submit file to get a monotonically increasing count. This is also useful if you need an arbitrary unique identifier. For example, to submit 10 jobs, where the first job will get the argument "0", the second job "1", and so on, you could use:

executable = myprogram.exe
arguments  = $(Process)
queue 10

Simple math can use $$([]), in which case you'll use ProcId instead of $(Process). For example, this passes two arguments, the first starts a 1 and increases by 1 for each job, the second starts at 0 and increases by 2 for each job:

executable = myprogram.exe
arguments  = $$([ProcId+1]) $$([ProcId*2])
queue 10

Random selection

If you want each job to have a randomly assigned argument, you can use $RANDOM_CHOICE. The random selection is not guaranteed to be cryptographically strong, nor necessarily suitable for scientific use.

In this example, HTCondor assigns each job two random choices; an integer from 1 to 3, and a random name:

executable = myprogram.exe
arguments  = $RANDOM_CHOICE(1,2,3) $RANDOM_CHOICE(Alan, Betty, Claire)
queue 10

Permute a list

If you want to permute some other element, you can use $$([ ]) to evalute arbitrary ClassAd expressions. This is particularly useful combined with lists. If you wanted to permute the 3 names, you could do this:

executable = myprogram.exe
arguments  = $$([names[ProcId])
+names     = {"Alan", "Betty", "Claire"}
queue 3

Note that if you try to index into a non-existant list element, HTCondor will be unable to determine the final argument string and the job will be put on hold. If you want to loop over the list, you can use modulus arthimatic and the list of the list:

executable = myprogram.exe
arguments  = $$([thelist[ProcId%size(thelist)]])
+names     = {"Alan", "Betty", "Claire"}
queue 50