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

Re: [HTCondor-users] $INT conversion failing in submit file



On 01/01/18 15:16, Mike Fienen wrote:
Thanks for checking!

No problem, Mike. I can get the same error by putting this as my submit file:

-bash-4.2$Â cat sub.txt
Requirements =Â $INT(substr(Machine,7,9),'%d') <= 16
Executable = /bin/ls
Universe = vanilla
Queue

As so:

-bash-4.2$ condor_submit sub.txt
Submitting job(s)ERROR at Queue statement on Line 4: $INT() macro: '7,9' is not a valid format specifier! ÂÂÂ Âat Step 0, ItemIndex 0 while expanding requirements=$INT(substr(Machine,7,9),'%d') <= 16

The trouble is that the $INT macro doesn't do what it might purport to do: it doesn't take a string and make an integer out of it (which is what I think you want). It takes an integer and makes a string out of it!! So, since substr() yields a string, it causes trouble when it's used in conjunction with $INT (somehow, $INT sees that the type of the argument is a string and assumes that it's a format spec. That's my guess.) You can get rid of the error by using :

-bash-4.2$ cat sub.txt
Requirements =Â substr(Machine,7,9) <= 16
Executable = /bin/ls
Universe = vanilla
Queue

But now we have to wonder if the <= operator does automatically convert the arguments to comparable types. Would it take a string, convert it to a number and then compare? I don't know. You'd have to test that. By the way: that code, i.e. substr(Machine,7,9), would imply a machine name such as

Machine = "xxxxxxx000000016xxx"

Since the third operator of substr is a length. Not many people would call their machines that. Perhaps you mean substr(Machine,7,2)?

Cheers,

Ste