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

Re: [HTCondor-users] Querying Startd classad from python bindings



Antonio,

It's not documented, but you can direct query a Startd for Startd ads
*if you have the address* (e.g. the address from "condor_status -af
MyAddress") by passing the address as the argument when creating a
Collector object.  For example:

# query the Collector once for all of the Startd addresses on local machine
startd_ads = htcondor.Collector().query(htcondor.AdTypes.Startd,
'Machine =?= "{0}"'.format(htcondor.param['FULL_HOSTNAME']),
['MyAddress'])

# query each Startd directly
for startd_ad in startd_ads:
    startd = htcondor.Collector(startd_ad['MyAddress'])
    ads = startd.query(htcondor.AdTypes.Startd)

I checked, and this also works for Schedds and Schedd ads.

Using purely the Python bindings, I don't know of a way around getting
the addresses from the Collector. Maybe someone else can chime in? You
could use the CLI tools to get them (e.g. condor_status -direct
"$(condor_config_val full_hostname)" -af MyAddress) without bugging
the Collector, but that sort of defeats the purpose :)

Jason


On Fri, Oct 20, 2017 at 2:14 AM, Antonio Delgado Peris
<antonio.delgadoperis@xxxxxxxxx> wrote:
> Dear all,
>
> A (hopefully) quick question: does anybody know if there is a way to
> directly query a Startd (or other) daemon to get its classads, like
> 'condor_status -direct' does?
>
> Looking at the API, it seems to me that the only way is by querying the
> Collector (the only direct access to a Startd seems to be to get
> configuration or put to drain). I was hoping that one could query the Startd
> itself, not to bother the Collector.
>
> The use case would be for processes running on the Startd nodes that want to
> know the status of their local HTCondor daemons.
>
> Needless to say, I can achieve this by externally running 'condor_status
> -direct' from python (or by, well, querying the Collector), so it's not a
> big deal. But I was just wondering if I there was a more elegant/efficient
> way, using the API.
>
> Thank you!
>
> Cheers,
>
>    Antonio
>
> _______________________________________________
> 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/