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

[HTCondor-users] Python bindings and per job history files



Dear experts,

I am currently trying to parse our per job history files. The example I got together so far is
import classad;
f = open("/var/lib/gratia/condorce_data/history.10.0");
ads = classad.parseAds(f);
for c in ads:
ÂÂÂ print c
where the printout looks similar to that of a classAd (indeed the type is a class ad).

However,
print c["JobStatus"]
fails with
Traceback (most recent call last):
 File "test_history.py", line 7, in <module>
ÂÂÂ print c["JobStatus"]
StopIteration

From the examples I've seen, this should be possible.

Fun fact: if I add
print dir(c )
to the for-loop, it works.
Equivalently, if I change the iterator to a list
for c in ads: -> for c in list(ads):
it works as well.
Is this a bug in the way the iterator is constructed or am I missing something?


The history file can be seen here:
https://gist.github.com/kreczko/9056874bbb54a1b4a21b#file-gistfile1-txt
and the python example:
https://gist.github.com/kreczko/9056874bbb54a1b4a21b#file-python
working python:
https://gist.github.com/kreczko/9056874bbb54a1b4a21b#file-working-python

I am running htcondor 8.4.3 and python 2.6.6.

Cheers,
Luke

--
*********************************************************
 Dr Lukasz Kreczko     ÂÂ
 Research Associate
 Department of Physics
 Particle Physics Group

 University of Bristol

 HH Wills Physics Lab
 University of Bristol
 Tyndall Avenue
 Bristol
 BS8 1TL


 +44 (0)117 928 8724Â
ÂÂ
 A top 5 UK university with leading employers (2015)
 A top 5 UK university for research (2014 REF)
 A world top 40 university (QS Ranking 2015)
*********************************************************