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

Re: [HTCondor-users] Python bindings: ExprTree vs classad.eval



and another Python class ad question ;)

so, I have my class ad, that I can evaluate and let a variable point to the evulated result

   >>> pprint.pprint(  myjob.eval("RequestCpus")  )
   1L
   >>> FOO =  int(myjob.eval("RequestCpus"))
   >>> pprint.pprint(FOO)
   1

however, when I try to test on the evaluated(?) value, python throws an exception

    >>> if int( myjob.eval(["RequestCpus"])) not in cpus: ...
   EXCEPTION [1]

testing on the assigned variable works, i.e.,
    >>> if FOO not in cpus: ...
    ððð

I actually tried to see, what happens when I use (deep)copy in the if clause on the ad-eval - but got the same exception

What is Python here actually testing what in which order...? ð

I would have assumed, that functions would be called one by one and that the int(1L)~~> 1 then would be tested on `not in cpus`

Cheers,
  Thomas


[1]
Traceback (most recent call last):
  File "/tmp/jobsstats.py", line 166, in <module>
    if int(myjob.eval(["RequestCpus"])) not in cpus:
Boost.Python.ArgumentError: Python argument types in
    ClassAd.eval(ClassAd, list)
did not match C++ signature:
    eval(ClassAdWrapper {lvalue} self, std::string attr)

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