In the $INT() macro, what ever is after the , is passed as a printf formatter string, so you can do
$INT(Process,_%d_)
To get
_1_
Etc.
So we preserve the leading space in this case because you might want to have it, and it “probably” won’t matter
On the output side. The exception, of course is when you are token pasting as you are there.
On the other hand, because we allow for arbitrary printf formats, you could also do this.
remote_initialdir = $INT(Process, case=%d)
-tj
From: HTCondor-users [mailto:htcondor-users-bounces@xxxxxxxxxxx]
On Behalf Of Michael V Pelletier
Sent: Wednesday, February 17, 2016 2:58 PM
To: HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx>
Subject: Re: [HTCondor-users] Scratch space and input subdirectories
From: Todd Tannenbaum <tannenba@xxxxxxxxxxx>
Date: 02/17/2016 03:43 PM
> If your PreCmd creates a subdirectory $(Process), you could add
>
> remote_initialdir = $(Process)
>
> in your submit file to achieve what you want.
I tried that as well and it didn't work, so I thought the problem was that the directory had to exist before the PreCmd ran, but I didn't examine the hold message closely enough:
98.0 pelletm 2/17 14:25 Error from slot2@condor1: Failed to execute '/var/lib/condor/execute/dir_600967/condor_exec.exe' with arguments 600: Cannot access initial working directory "case= 1" (errno=2: 'No such
file or directory')
Note the space. I had the INT directive specified with a space after the comma, like so:
CASENUM = $(Process) + 1
CASEDIR = case=$INT(CASENUM, %d)
remote_initialdir = $(CASEDIR)
Spaces after commas and around plus signs make me happier, I'm funny that way. But that gave a string of "case= 1" instead of "case=1" as the hold message was trying to explain. Once I changed it to $INT(CASENUM,%d) it works,
and the ssh to the job places me in the working directory of the executable, $TMPDIR/case=1.
Thanks! It wouldn't be a bad idea to have a note of these little caveats in the manual - for instance $$([$(Process)+1]) can't have spaces either.
-Michael Pelletier.