Mailing List Archives
Authenticated access
|
|
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [HTCondor-users] proper way to check fo undefined classAd in python
- Date: Wed, 22 Jun 2022 14:44:12 +0000
- From: John M Knoeller <johnkn@xxxxxxxxxxx>
- Subject: Re: [HTCondor-users] proper way to check fo undefined classAd in python
!= should never have worked to compare undefined. So if this used to work in the python bindings that was a bug.
Undefined is not like other values, it cannot be compared using == or !=, it can only be compared using the exact equality (is or =?=) or exact inequality (isnt or =!=) operators
-tj
-----Original Message-----
From: HTCondor-users <htcondor-users-bounces@xxxxxxxxxxx> On Behalf Of Stefano Belforte
Sent: Tuesday, June 21, 2022 12:17 PM
To: HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx>
Subject: [HTCondor-users] proper way to check fo undefined classAd in python
Hi experts !
I need to know what is the proper way to check if a classAd is Undefined
when using HTCondor python bindings.
Longish story short (check [1] if you care for context and details) :
I have some oldish python script which uses
import classad
.. get some classAd list via querying schedd via condor bindings...
if someAd != classad.Value.Undefined:
blah blah
and I found that it does not work anymore (new HTCondor release ?
I am running that with 9.2.0 atm) move to python3 ? It is a tiny corner
of our phase space and it went un-noticed for who knows how long).
Instead this works:
if someAd is not classad.Value.
does nor work means that the output of someAd != classad.Value.Undefined
is not a boolean any more, with python debugger:
(Pdb) ad['CRAB_UserGroup'] != classad.Value.Undefined
undefined != undefined
Yes, I can replace "!=" with "is not", no problem, it works for me now,
but I need to know if this works by accident (like the previous way ? not
my code, do not shoot the messenger), or if it is the correct syntax
and will work forever. Or what is otherwise your recommendation.
I looked in https://htcondor.readthedocs.io/en/latest/apis/python-bindings/api/classad.html
but could not find this information (does not mean that it is not there, of course).
Thanks
Stefano
[1]
https://github.com/dmwm/CRABServer/issues/7288
_______________________________________________
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/