[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Condor-users] Offset $(process) or simple arithmetic in JDL file

On 12/15/2011 08:58 PM, Emir Imamagic wrote:

I just spent some time trying to figure out is there a way to offset
$(Process) variable or at least do some simple arithmetic and store it
in another macro. We have couple of users who could benefit from queuing
large amount of jobs, but it is too complicated for them to tune their
input files and arguments to 0-N. Right now they are using scripts but
it would be much more elegant to have a solution based purely on JDL.

Initially it seemed impossible according to threads:
- "Condor submit file and process number" (16.7.2004)
- "Question about $(Process)" (4.7.2005)
- "$(Process)" (24.6.2006)
- "process number to start higher than zero" (19.8.2010)
- "Help with ClassAd syntax: offset $(process)" (2.2.2011.)

Finally I was lucky and spotted this thread from 2008: "$(Process) not
starting at 0" which indicated that the solution is implemented in 7.1
and should work like this:
This is even listed in new features of 7.1:


Since that is an old, development version seemed logical to me that this
feature is still there in the latest stable version (condor-7.6.4-1).
Unfortunately simple test proved me wrong, expression is not expanded
and I ended up with file with containing $$([0+1]) in its name.

Does anyone know what happened with this feature or how did it get lost
between 7.1 and 7.6? I quickly went through Version history but couldn't
find anything.

Also, if anyone has a different suggestion it will be more then welcome.

Thanks in advance

It still works, but apparently has some cruft if you use it in a file name.

$ cat test.sub
cmd = /bin/echo
args = $$([$(Process)+100])
output = test.out.$$([$(Process)+100])
queue 10

$ cat test.out.*


$ ls test.out.*
0 test.out.$$([0+100]) 0 test.out.$$([5+100]) 4 test.out.100 4 test.out.105 0 test.out.$$([1+100]) 0 test.out.$$([6+100]) 4 test.out.101 4 test.out.106 0 test.out.$$([2+100]) 0 test.out.$$([7+100]) 4 test.out.102 4 test.out.107 0 test.out.$$([3+100]) 0 test.out.$$([8+100]) 4 test.out.103 4 test.out.108 0 test.out.$$([4+100]) 0 test.out.$$([9+100]) 4 test.out.104 4 test.out.109

condor_submit is being too helpful, checking that the output file can be written to upfront. In this case, condor_submit could check the correct file, but in general condor_submit has no hope of knowing what the expression will evaluate to. Seems condor_submit should skip this file check when $$([]) is present.