Collector Class

class htcondor2.Collector(pool=None)

The collector client. Locate one or more daemons, query for arbitrary ads, ask arbitrary daemons directly for their ads, or push new ads into the collector.

Parameters

pool (Union[str, ClassAd, List[str], Tuple[str], None]) – A host::port string specifying the remote collector, a list (or tuple) of such strings, or a ClassAd with a MyAddress attribute (such as might be returned by locate()). None means the value of the configuration parameter COLLECTOR_HOST.

advertise(ad_list, command='UPDATE_AD_GENERIC', use_tcp=True)

Add ClassAd(s) to the collector.

Parameters
  • ad_list (List[ClassAd]) – The ClassAd(s) to advertise.

  • command (str) – The “advertise command” specifies which kind of ad is being added to the collector. Different types of ads require different authorization. The list of valid “advertising commands” is kept in the condor_advertise manpage.

  • use_tcp (bool) – Never set this to False.

Return type

None

directQuery(daemon_type, name=None, projection=None, statistics=None)

As query(), except querying the specified type of daemon rather than the collector, which means that at most one ad will be returned.

Parameters
  • daemon_type (DaemonType) – Which type of daemon to query. Some daemons respond to more than one daemon type.

  • name (Optional[str, None]) – The daemon’s name (the Name attribute from its ad in the collector). If None, use the local daemon.

  • projection (Optional[List[str], None]) – See query().

  • statistics (str) – See query().

Return type

ClassAd

locate(daemon_type, name=None)

Return a ClassAd with enough data to contact a daemon (of the specified type) known to the collector.

If more than one daemon matches, return only the first. Use locateAll() to find all daemons of a given type, or query() for all daemons of a given name.

Parameters
  • daemon_type (DaemonType) – The type of daemon to locate.

  • name (Optional[str, None]) – The daemon’s name (the Name attribute from its ad in the collector). If None, look for local daemon of the specified type.

Return type

ClassAd

locateAll(daemon_type)

Return a list of classad2.ClassAds, each enough data to contact a daemon known of the given type to the collector.

Parameters

daemon_type (DaemonType) – Which type of daemons to locate.

Return type

List[ClassAd]

query(ad_type=AdType.Any, constraint=None, projection=None, statistics=None)

Returns classad2.ClassAd(s) from the collector.

Parameters
  • ad_type (AdType) – The type of ClassAd to return.

  • constraint (Optional[str, None]) – Only ads matching this expression are returned; if not specified, all ads are returned.

  • projection (Optional[List[str], None]) – Returned ClassAds will have only these attributes (plus a few the collector insists on). If not specified, return all attributes of each ad.

  • statistics (Optional[str, None]) – Specify the additional statistical attributes to include, if available, using the same syntax as STATISTICS_TO_PUBLISH.

Return type

List[ClassAd]