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

Re: [HTCondor-users] python bindings?



i pulled this example from Tannenbaum's slides from ISGC2019

ad = classad.ClassAd('[a=1; b=4; tot=a+b]')
print ad['a']
print ad['tot']
print ad['tot'].eval()
1
a + b
5
print ad.eval('tot')
5

now it makes sense to me.  the one thing i miss from perl is the
examples/example code in perldoc's



On Thu, Sep 3, 2020 at 11:22 AM Jason Patton <jpatton@xxxxxxxxxxx> wrote:
>
> Welcome to the world of the Python bindings! What you have been returned is a ClassAd object, which will act very similar to a dict (and can be easily turned into a dict) but with some different properties:
>
> https://htcondor.readthedocs.io/en/latest/apis/python-bindings/api/classad.html#classad.ClassAd
>
> Two properties of ClassAd objects that you should immediately be aware of is
> 1. The keys are case-insensitive
> 2. The values can contain expressions (classad.ExprTree objects) that can reference ClassAd functions ( see https://htcondor.readthedocs.io/en/latest/misc-concepts/classad-mechanism.html ) and that can reference other keys ("attributes") that may or may not be in the ClassAd object you have been returned
>
> Jason Patton
>
> On Thu, Sep 3, 2020 at 10:10 AM <mdidomenico4@xxxxxxxxx> wrote:
>>
>> i'm newish to python and definitely new to the python bindings for
>> htcondor.  I don't understand the return values
>>
>> (this is all pseudo code)
>>
>> for job in schedd.xquery(projection=[]):
>>   print(job)
>>
>> the returned values are something like
>>
>> [ blah = "blah";
>>   blah = "blah";
>>   blah = "blah"; ]
>>
>> what i expected was that 'job' would be a dictionary that i could then
>> iterate or reference into like a normal key/value hash
>>
>> i looked over the docs and tutorials, but i think i'm missing
>> something fundamental here
>> _______________________________________________
>> 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/
>
> _______________________________________________
> 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/