Startd Class

class htcondor2.Startd(location=None)

The startd client. Used to access the startd history and to control draining.

Parameters:

location (ClassAd | None) – A ClassAd with a MyAddress attribute, such as might be returned by htcondor2.Collector.locate(). None means the the local daemon.

cancelDrainJobs(request_id=None) None

Cancel a draining request.

Parameters:

request_id (str | None) – An opaque drain request ID returned by a previous call to drainJobs(). If None, cancel all draining requests for this startd.

drainJobs(drain_type=DrainType.Graceful, on_completion=CompletionType.Nothing, check_expr=None, start_expr=None, reason=None) str

Request that this startd begin draining.

Parameters:
  • drain_type (DrainType) – How much time, if any, jobs are given to finish.

  • on_completion (CompletionType) – What to do when the startd finishes draining.

  • check_expr (str | None) – An expression which must evaluate to True in the context of each slot ad for draining to begin. If None, treated as True.

  • start_expr (str | None) – The value of the START expression while the startd is draining. If None, use the configured default (DEFAULT_DRAINING_START_EXPR).

  • reason (str | None) – A string describing the reason for draining.

Returns:

An opaque request ID only useful for cancelling this drain via cancelDrainJobs().

Return type:

str

history(constraint=None, projection=[], match=-1, since=None) List[ClassAd]

Query this startd’s job history.

Parameters:
  • constraint (str | ExprTree | None) – A query constraint. Only jobs matching this constraint will be returned. None will match all jobs.

  • projection (List[str]) – A list of job attributes. These attributes will be returned for each job in the list. (Others may be as well.) The default (an empty list) returns all attributes.

  • match (int) – The maximum number of ads to return. The default (-1) is to return all ads.

  • since (int | str | ExprTree) –

    A cluster ID, job ID, or expression. If a cluster ID (passed as an integer) or job ID (passed as a string in the format {clusterID}.{procID}), only jobs recorded in the history file after (and not including) the matching ID will be returned. If an expression (including strings that aren’t job IDs), jobs will be returned, most-recently-recorded first, until the expression becomes true; the job making the expression become true will not be returned. Thus, 1038 and "clusterID == 1038" return the same set of jobs.

    If None, return all (matching) jobs.

Returns:

A list of job ClassAds.

Return type:

List[ClassAd]

rehome(schedd_name=None, timeout=0, cancel=False) None

Send a rehome command to this startd, killing all running jobs.

Parameters:
  • schedd_name (str | None) – The name of the schedd to rehome to.

  • timeout (int) – Timeout for the rehome operation.

  • cancel (bool) – If True, cancel a previous rehome by unsetting STARTD_DIRECT_ATTACH_SCHEDD without evicting jobs.

vacate(vacate_fast=VacateType.Graceful) None

Evict all jobs running on active slots. Eviction is graceful unless vacate_fast is set to VacateType.Fast.

Parameters:

vacate_fast (VacateType) – Fast to evict fast. None or Graceful to evict graceful.

vacateSlot(slot_name=None, vacate_fast=VacateType.Graceful) None

Evict the job running on an active slot. Eviction is graceful unless vacate_fast is set to VacateType.Fast.

Parameters:
  • slot_name (str | None) – The name of the slot.

  • vacate_fast (VacateType) – Fast to evict fast. None or Graceful to evict graceful.