Mailing List Archives
Authenticated access
|
|
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [HTCondor-users] $INT conversion failing in submit file
- Date: Wed, 3 Jan 2018 23:33:03 +0000
- From: John M Knoeller <johnkn@xxxxxxxxxxx>
- Subject: Re: [HTCondor-users] $INT conversion failing in submit file
$INT() (and all of the $xxx macros) expand AT SUBMIT TIME. They can refer to other variables in the submit file, but not to job attributes or to machine attributes. Also, the body of $INT() or any of the $() macro functions may not contain any () characters. so this
$INT(substr(Machine,7,9),'%d')
simply will not parse. while this
temp = substr(Machine,7,9)
requirements = $INT(temp,%d) <= 16
Will parse, but since Machine is not defined at submit time, substr(Machine,7,9) will evaluate to undefined, which cannot be printed as an integer.
As was mentioned, you need to use int() here since you want to refer to an attribute of the slot at match time, rather than a variable of the submit file at submit time.
Think of $INT() as just like $(), It still expands at submit time using submit variables, but you get to control the way the value is formatted. So it can be do things like having each job in the cluster match to a different (specific) machine.
requirements = Machine == "exec_node_$INT(Process,%04d)"
So Job 10.0 will have
requirements = Machine == "exec_node_0000"
job 10.1 will have
requirements = Machine == "exec_node_0001"
etc.
-----Original Message-----
From: HTCondor-users [mailto:htcondor-users-bounces@xxxxxxxxxxx] On Behalf Of Todd L Miller
Sent: Wednesday, January 3, 2018 4:36 PM
To: HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx>
Subject: Re: [HTCondor-users] $INT conversion failing in submit file
> Hereʼs my requirements line:
>
> ( substr(Machine,0,5)=="ARCWI") && ($INT(substr(Machine,7,9),'%d') <= 16))
>
> If I only use the first statement, only ARCWI machines are matched, but
> I also need to limit to number 16 or less.
As I understand it, $INT() is a macro and not a parsed function
cal. That means the literal text of everything to the left of the first
comma inside the parentheses must be a valid macro (reference), and
everything to the right of it must be a valid format string. (I'm not
sure if $INT() even properly nests parentheses, but based on the error
message you posted, I'm guessing it doesn't.) Something like the
following in your submit file should work:
+MachineNumber = substr(Machine,7,2)
Requirements = ... ($INT(MachineNumber) <= 16) ...
However, as ToddT noted, pretty much anywhere you can use the
ClassAd function int() you should prefer it to the $INT() macro (which is
intended for configuration files).
- ToddM