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

Re: [HTCondor-users] regexp in if clauses and Group* information availability

the conditional of a transform if can only be a simple literal value, version test or defined test.  it cannot be an expression.

This is ok

   if defined my.boolad

And if boolad is true, false, 0 or 1  then this is ok

   if $(MY.boolad)

but if boolad is an expression, you need to force that to evaluate into temp variable before you can use it in an if statement

    EVALMACRO boolad_is_true my.boolad
    if $(boolad_is_true)

In some cases you can use $INT() to force evaluation at the time of $() expansion like this.

    if $INT(MY.boolad)

This is the same for configuration files - the condition of an if in a config file can only be a simple boolean value, not an expression.

-----Original Message-----
From: HTCondor-users <htcondor-users-bounces@xxxxxxxxxxx> On Behalf Of Thomas Hartmann
Sent: Friday, March 18, 2022 8:43 AM
To: HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx>
Subject: [HTCondor-users] regexp in if clauses and Group* information availability

Hi all,

I am currently refactoring our grid cluster's accounting & GROUP_SORT
code and just stumbled over two things.

Apparently, a regexp() expression cannot be used in a transform's
if-clause directly, or? I tried to use the function like in [1] but run
into an error

 > (1370.0) job_transforms: ERROR applying transform DESYAccounting
(err=-3,rval=-1,msg=regexp("\/cms\/Role=lcgadmin",x509UserProxyFQAN ? :
"") is not a valid if condition)

I guess that the expression would have to be stored first in an ad, or?
(btw: how can I actually use a boolean as a case condition? `if boolad`
or `if eval(boolad)` seem not to work)

The other thing is, that I tried to prepare the GROUP_SORT ranking
already in the job transformation, but the evaluation of the Group*
details returns an error.
The current usage ads like `GroupResourcesInUse` or `GroupQuota` make
probably no sense in a transformation, as they exists only during the
matching cycle, or?



JOB_TRANSFORM_AcctTuning @=end


if regexp("\/cms\/Role=lcgadmin",x509UserProxyFQAN ? : "")
  SET DESYAcctGroup = "group_OPS"
  SET GROUPFOO = eval(GroupResourcesInUse/GroupQuota + 3.0)