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

Re: [HTCondor-users] comparison operators in job transforms/routes



Hi John,

ah - many thanks for the clarification.

yes, the confused parser confused me as well - I had been testing with 1core jobs where the expression seemed to work, but everything went haywire, when I actually tried mcores ;)

Cheers and thanks,
  Thomas


On 29/09/2021 16.50, John M Knoeller wrote:
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/users-manual/submitting-a-job.html#using-conditionals-in-the-submit-description-file> https://htcondor.readthedocs.io/en/latest/misc-concepts/transforms.html <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


_______________________________________________
HTCondor-users mailing list
To unsubscribe, send a message to htcondor-users-request@xxxxxxxxxxx with a
subject: Unsubscribe
You can also unsubscribe by visiting
https://lists.cs.wisc.edu/mailman/listinfo/htcondor-users

The archives can be found at:
https://lists.cs.wisc.edu/archive/htcondor-users/


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature