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

Re: [HTCondor-users] condor chirp attribute update with non-string data structures



Hi Todd,

yes, it seems that chirp only accepts strings. I just tried to feed a classad object to chirp, but it accepts only byte/strings [1].

afais a classad object can not be easily flatten/serialized into a htchirp compatible string. For python dicts flatten()/printJson/printOld/... return strings in different formattings or fail.

btw: can python list be cast into classads? I tried something like [2] but failed. Max suggested to use enumerate for Lua-like lists with keys as consecutive numbers, but one would need to explicitly cast the int indices into strings in a second step.

Cheers and thanks,
  Thomas

[1]
fooAd = classad.ClassAd({"key1": "value1", 'key2':'value2'})
with htcondor.htchirp.HTChirp() as chirp:
    chirp.connect()
    chirp.set_job_attr("THTestDict",fooAd)
    chirp.disconnect()

Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
File "/usr/lib64/python3.6/site-packages/htcondor/htchirp/htchirp.py", line 705, in set_job_attr
    quote(job_attribute), quote(attribute_value)
File "/usr/lib64/python3.6/site-packages/htcondor/htchirp/htchirp.py", line 43, in quote
    return escape.sub(replace, chirp_string)
TypeError: expected string or bytes-like object

[2]
listAd = classad.ClassAd(['1','22','333'])

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