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

Re: [HTCondor-users] A few questions about the format of variables (classads) and their values when using the python bindings



> On Jul 27, 2015, at 4:10 PM, Jose Caballero <jcaballero.hep@xxxxxxxxx> wrote:
> 
>> 
>>> (3) Similar to that. What about
>>>  +TransferOutput = ""
>>> what should be the value of the classad? double quotes in between
>>> single quotes? double quotes escaped in between double quotes? Just
>>> double quotes? â?
>> 
>> Anything starting with â+â is a ClassAd attribute and must obey ClassAd quoting rules (strings start with double quotes).
>> 
> 
> 
> Hi Brian,
> 
> after sending the email, I got the classads CopyToSpool and
> NordugridRSL reading the condor C code. I didn't have it at the time
> of sending the email.
> 
> I didn't know one can use python boolean True and False when setting a
> ClassAd. I thought it had to be a string, but not sure if upper case
> of lower case. Using boolean objects True/False makes everything
> easier.
> 

The ClassAd library will automatically cast basic literals (strings, integers, floats, booleans, lists, dictionaries) from python to ClassAds.  If you set:

ad[âfooâ] = âtrueâ

this will not do what you want; it will not be the boolean, but rather a string with value âtrueâ.  Unlike some scripting languages, ClassAds doesnât do very aggressive lazy casting.  For example:

>>> classad.ExprTree('"true" == true').eval()
classad.Value.Error


> On the TransferOutput, should I understand then that the way would be
> just as follows?
> 
>     classad.ClassAd( { "TransferOutput" : "" } )
> 

Yup!

Brian