The transform language allows only true, false, 0, non-zero, and defined after if
You need to use EVALMACRO to evaluate a more complex conditional _expression_ and resolve it to a simple literal true, false, 0, or non-zero value like this
EVALMACRO more_than_2_cpus = (RequestCpus ?: 1) > 2
if $(more_than_2_cpus)
# conditional statements
endif
I'm a bit surprised that you don't see an error message for all cases, the only time it is valid to use =
on the same line as the if is when doing version comparison, so I'm guessing that the parser is confused.
-tj
From: HTCondor-users <htcondor-users-bounces@xxxxxxxxxxx> on behalf of Thomas Hartmann <thomas.hartmann@xxxxxxx>
Sent: Wednesday, September 29, 2021 8:15 AM To: HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx> Subject: [HTCondor-users] comparison operators in job transforms/routes Hi all,
I am trying to write a job transform, where I would like to make a case comparison like [1]. My problem is right now, that the ad's value comparison fails for the condition with > job_transforms: ERROR applying transform DESYMCOREReweight (err=-3,rval=-1,msg=RequestCpus >= 2 is not a valid if condition) I tried $(var) like `if $(RequestCpus) >= 2` as well, but the ad (to be evaluated) seems to be too compound for being a <simple condition> > job_transforms: ERROR applying transform DESYMCOREReweight (err=-3,rval=-1,msg=$(RequestCpus) >= 2 is not a valid if condition because complex conditionals are not supported) assuming that syntax is the same for job transforms/routes with 8.9+ and submissions [2] Interestingly, no error is thrown when the integer of requested cores and the integer in the comparison are the same, i.e., `RequestCpus >= 3` with `request_cpus = 3`. Maybe I am missing something obvious here, but in principle it should work to do comparison operations in job transforms conditionals, or? Installed packages are [3] Cheers, Thomas [1] JOB_TRANSFORM_NAMES = $(JOB_TRANSFORM_NAMES), MCOREReweight JOB_TRANSFORM_MCOREReweight @=end if RequestCpus >= 2 EVALSET MYAcctGroup = $(MYAcctGroup).mcore else EVALSET MYAcctGroup = $(MYAcctGroup).score endif @end [2] https://htcondor.readthedocs.io/en/latest/users-manual/submitting-a-job.html#using-conditionals-in-the-submit-description-file https://htcondor.readthedocs.io/en/latest/misc-concepts/transforms.html [3] condor-9.0.6-1.el7.x86_64 condor-boinc-7.16.16-1.el7.x86_64 condor-classads-9.0.6-1.el7.x86_64 condor-externals-9.0.6-1.el7.x86_64 condor-procd-9.0.6-1.el7.x86_64 htcondor-ce-5.1.1-1.el7.noarch htcondor-ce-apel-5.1.1-1.el7.noarch htcondor-ce-bdii-5.1.1-1.el7.noarch htcondor-ce-client-5.1.1-1.el7.noarch htcondor-ce-condor-5.1.1-1.el7.noarch htcondor-ce-view-5.1.1-1.el7.noarch python2-condor-9.0.6-1.el7.x86_64 python3-condor-9.0.6-1.el7.x86_64 |