Schedd Class

class htcondor2.Schedd(location=None)

Client object for a condor_schedd.

Parameters:

location (ClassAd | None) – A classad2.ClassAd specifying a remote condor_schedd daemon, as returned by Collector.locate(). If None, the client will connect to the local condor_schedd.

act(action, job_spec, reason=None) ClassAd

Change the status of job(s) in the condor_schedd daemon.

Parameters:
  • action (JobAction) – The action to perform.

  • job_spec (List[str] | str | ExprTree | int) – Which job(s) to act on. A str of the form clusterID[.procID], a list of such strings, a classad2.ExprTree constraint, the the string form of such a constraint, or the int cluster ID.

  • reason (str) – A free-form justification. Defaults to “Python-initiated action”.

Returns:

A ClassAd describing the number of jobs changed. This ClassAd is currently undocumented.

Return type:

ClassAd

addProjectRec(project_spec) ClassAd

Add Project record(s) to the condor_schedd daemon.

Parameters:

project_spec (List[str] | str | List[ClassAd]) – Which projects(s) to add. A str of the project name, a list of such strings, or a list of the initial Project records in classad2.ClassAd form.

Returns:

A ClassAd describing the changes made. This ClassAd is currently undocumented.

Return type:

ClassAd

addUserRec(user_spec) ClassAd

Add User record(s) to the condor_schedd daemon if a User record with the given name does not already exist.

Parameters:

user_spec (List[str] | str | List[ClassAd]) – Which user(s) to add. A str of the username, a list of such strings, or a list of the initial User records in classad2.ClassAd form.

Returns:

A ClassAd describing the changes made. This ClassAd is currently undocumented.

Return type:

ClassAd

create_ocu(request) ClassAd

Send a classad representing an OCU claim request to the schedd.

Parameters:

request (ClassAd) – ClassAd representing the OCU claim request must contain Owner, and RequestCpu, Memory, maybe disk

Returns:

A ClassAd containing information about the create operation.

Return type:

ClassAd

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

Query this schedd’s historical records from its local daemon history file.

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

  • projection (List[str]) – A list of ClassAd attributes. These attributes will be returned for each ad 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 (ExprTree | None) –

    A ClassAd expression representing when the query should stop scanning historical ClassAd records. The query stops when the expression evaluates to true.

    If None, return all (matching) ClassAds.

Returns:

List of ClassAds.

Return type:

List[ClassAd]

disableProjectRec(project_spec, reason=None) ClassAd

Disable Project record(s) in the condor_schedd daemon.

Parameters:
  • user_spec – Which user(s) to disable. A str of the username, a list of such strings, or a classad2.ExprTree constraint. When a constraint is used, only Project records that match the constraint will be disabled.

  • reason (str) – A free-form justification. Defaults to “Python-initiated action”.

Returns:

A ClassAd describing the changes made. This ClassAd is currently undocumented.

Return type:

ClassAd

disableUserRec(user_spec, reason=None) ClassAd

Disable User record(s) in the condor_schedd daemon.

Parameters:
  • user_spec (List[str] | str | ExprTree) – Which user(s) to disable. A str of the username, a list of such strings, or a classad2.ExprTree constraint. When a constraint is used, only User records that match the constraint will be disabled.

  • reason (str) – A free-form justification. Defaults to “Python-initiated action”.

Returns:

A ClassAd describing the changes made. This ClassAd is currently undocumented.

Return type:

ClassAd

edit(job_spec, attr, value, flags=<TransactionFlag.Default) int

Change the value of an attribute in zero or more jobs.

Parameters:
  • job_spec (List[str] | str | ExprTree | int) – Which job(s) to act on. A str of the form clusterID[.procID], a list of such strings, a classad2.ExprTree constraint, the the string form of such a constraint, or the int cluster ID.

  • attr (str) – Which attribute to change.

  • value (str | ExprTree) – The new value for the attribute.

  • flags (TransactionFlag) – Optional flags specifying alternate transaction behavior.

Returns:

The number of jobs that were edited.

Return type:

int

enableProjectRec(project_spec) ClassAd

Enable Project record(s) to the condor_schedd daemon.

Parameters:

user_spec – Which project(s) to enable. A str of the project name, a list of such strings, or a classad2.ExprTree constraint. When a constraint is used, only Project records that match the constraint will be enabled.

Returns:

A ClassAd describing the changes made. This ClassAd is currently undocumented.

Return type:

ClassAd

enableUserRec(user_spec) ClassAd

Enable User record(s) to the condor_schedd daemon.

Parameters:

user_spec (List[str] | str | ExprTree) – Which user(s) to enable. A str of the username, a list of such strings, or a classad2.ExprTree constraint. When a constraint is used, only User records that match the constraint will be enabled.

Returns:

A ClassAd describing the changes made. This ClassAd is currently undocumented.

Return type:

ClassAd

export_jobs(job_spec, export_dir, new_spool_dir) ClassAd

Export one or more job clusters from the queue to put those jobs into the externally managed state.

Parameters:
  • job_spec (List[str] | str | ExprTree | int) – Which job(s) to act on. A str of the form clusterID[.procID], a list of such strings, a classad2.ExprTree constraint, the the string form of such a constraint, or the int cluster ID.

  • export_dir (str) – Write the exported job(s) into this directory.

  • new_spool_dir (str) – The IWD of the export job(s).

Returns:

A ClassAd containing information about the export operation. This type of ClassAd is currently undocumented.

Return type:

ClassAd

get_claims(constraint=None, projection=[]) List[ClassAd]

Query the schedd for the list of classads that represent claimed slots

Parameters:
  • constraint (str | ExprTree | None) – Constraint expression to return only the matching claims. If empty, return all matches.

  • projection (List[str]) – List of specific ClassAd attributes to return from each match. If not specified the full match is returned.

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

Query this schedd’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:

List of ClassAds.

Return type:

List[ClassAd]

import_exported_job_results(import_dir) ClassAd

Import results from previously exported jobs, and take those jobs back out of the externally managed state.

Parameters:

import_dir (str) – Read the imported jobs from this directory.

Returns:

A ClassAd containing information about the import operation. This type of ClassAd is currently undocumented.

Return type:

ClassAd

jobEpochHistory(constraint=None, projection=[], match=-1, since=None, **kwargs) List[ClassAd]

Query this schedd’s job epoch 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:

List of ClassAds.

Return type:

List[ClassAd]

query(constraint='True', projection=[], callback=None, limit=-1, opts=<QueryOpt.Default) List[ClassAd]

Query the condor_schedd daemon for job ads.

Parameters:
  • constraint (str | ExprTree) – A query constraint. Only jobs matching this constraint will be returned. The default will return 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.

  • callback (Callable[[ClassAd], Any]) – A filtering function. It will be invoked for each job ad which matches the constraint. The value returned by callback will replace the corresponding job ad in the list returned by this method unless that value is None, which will instead be omitted.

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

  • opts (QueryOpt) – Special query options; see the enumeration for details.

queryProjectAds(constraint='', projection=[], callback=None, limit=-1) List[ClassAd]

Query the condor_schedd daemon for project ads.

Parameters:
  • constraint (str | ExprTree) – A query constraint. Only project ads matching this constraint will be returned. The default will return all project ads

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

  • callback (Callable[[ClassAd], Any]) – A filtering function. It will be invoked for each project ad which matches the constraint. The value returned by callback will replace the corresponding project ad in the list returned by this method unless that value is None, which will instead be omitted.

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

queryUserAds(constraint='', projection=[], callback=None, limit=-1) List[ClassAd]

Query the condor_schedd daemon for user ads.

Parameters:
  • constraint (str | ExprTree) – A query constraint. Only user ads matching this constraint will be returned. The default will return all user ads

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

  • callback (Callable[[ClassAd], Any]) – A filtering function. It will be invoked for each user ad which matches the constraint. The value returned by callback will replace the corresponding user ad in the list returned by this method unless that value is None, which will instead be omitted.

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

query_ocu(request) ClassAd

Query the schedd for all the OCU ads

Parameters:

request (ClassAd) – ClassAd representing the query

Returns:

A list of OCU ClassAds

Return type:

ClassAd

refreshGSIProxy(cluster, proc, proxy_filename, lifetime=-1) int

Refresh a (running) job’s GSI proxy.

Parameters:
  • cluster (int) – The job’s cluster ID.

  • proc (int) – The job’s proc ID.

  • proxy_filename (str) – The name of the file containing the refreshed proxy.

  • lifetime (int) – The desired lifetime (in seconds) of the refreshed proxy. Specify 0 to avoid changing the proxy’s lifetime. Specify -1 to use the value specific by DELEGATE_JOB_GSI_CREDENTIALS_LIFETIME.

Returns:

The remaining lifetime.

Return type:

int

removeProjectRec(user_spec, reason=None) ClassAd

Remove Project record(s) in the condor_schedd daemon.

Parameters:
  • Project_spec – Which projects(s) to remove. A str of the project name, a list of such strings, or a classad2.ExprTree constraint. When a constraint is used, only User records that match the constraint will be removed.

  • reason (str) – A free-form justification that is used when the record cannot be removed. Defaults to “Python-initiated action”.

Returns:

A ClassAd describing the changes made. This ClassAd is currently undocumented.

Return type:

ClassAd

removeUserRec(user_spec, reason=None) ClassAd

Remove User record(s) in the condor_schedd daemon.

Parameters:
  • user_spec (List[str] | str | ExprTree) – Which user(s) to remove. A str of the username, a list of such strings, or a classad2.ExprTree constraint. When a constraint is used, only User records that match the constraint will be removed.

  • reason (str) – A free-form justification that is used when the record cannot be removed. Defaults to “Python-initiated action”.

Returns:

A ClassAd describing the changes made. This ClassAd is currently undocumented.

Return type:

ClassAd

remove_ocu(request) ClassAd

Send a classad representing an existing OCU id request to be removed.

Parameters:

request (ClassAd) – ClassAd representing the OCU claim request must contain the OCU id

Returns:

A ClassAd containing information about the remove operation.

Return type:

ClassAd

reschedule() None

Sends the reschedule command to this schedd, which asks the schedd to ask the negotiator to consider starting the next negotiation cycle. Frequently has no effect, because the negotiator is either already busy or waiting out the minimum cycle time.

retrieve(job_spec) None

Retrieve the output files from the job(s) in a given submit().

Parameters:

job_spec (List[str] | str | ExprTree | int) – Which job(s) to act on. A str of the form clusterID[.procID], a list of such strings, a classad2.ExprTree constraint, the the string form of such a constraint, or the int cluster ID.

spool(result) None

Upload the input files corresponding to a given submit() for which the spool flag was set.

submit(description, count=0, spool=False, itemdata=<object object>, queue=None) SubmitResult

Submit one or more jobs.

Note

This function presently uses warnings to pass along the warnings generated about the submit. Python by default suppresses the second and subsequent reports of a warning for the same line of code.

Parameters:
  • description (Submit) – The job(s) to submit.

  • count (int) – Every valid queue statement in the submit language has an associated count, which is implicitly 1, but may be set explicitly, e.g., queue 3 dat_file matching *.dat has a count of 3. If specified, this parameter overrides the count in description.

  • spool (bool) – If True, submit the job(s) on hold and in such a way that its input files can later be uploaded to this schedd’s SPOOL directory, using spool().

  • itemdata (Iterator[str] | Iterator[dict] | None) – If your submit description includes a queue statement which requires item data, you may supply (or override) that item data with this parameter. If you provide an iterator over strings, each string will be parsed as its own item data line. If you provide an iterator over dictionaries, the dictionary’s key-value pairs will become submit variable name-value pairs; only the first dictionary’s keys will be used. In either case, leading and trailing whitespace will be trimmed for each individual item. Lines (and items) may not contain newlines (\n) or the ASCII unit separator character (\x1F). Keys, if specified, must be valid submit-language variable names.

  • queue (str) – Arguments to a queue statement to be used (instead of the one supplied in description, if any). Mutually exclusive with itemdata and/or count. (You may preface the the keyword’s string value with “queue “, if you prefer.)

unexport_jobs(job_spec) ClassAd

Unexport one or more job clusters that were previously exported from the queue.

Parameters:

job_spec (List[str] | str | ExprTree | int) – Which job(s) to act on. A str of the form clusterID[.procID], a list of such strings, a classad2.ExprTree constraint, the the string form of such a constraint, or the int cluster ID.

Returns:

A ClassAd containing information about the unexport operation. This type of ClassAd is currently undocumented.

Return type:

ClassAd

updateProjectRec(project_attributes) ClassAd

Edit/Update Project record(s) in the condor_schedd daemon

Parameters:

project_attributes (List[ClassAd]) – Which attributes to update. A list of the new Project record attribute values in classad2.ClassAd form. Each ad must have a Name or Requirements attribute to indentify which Project records to update.

Returns:

A ClassAd describing the changes made. This ClassAd is currently undocumented.

Return type:

ClassAd

updateUserRec(user_attributes) ClassAd

Edit/Update User record(s) in the condor_schedd daemon

Parameters:

user_attributes (List[ClassAd]) – Which attributes to update. A list of the new User record attribute values in classad2.ClassAd form. Each ad must have a User or Requirements attribute to indentify which User records to update.

Returns:

A ClassAd describing the changes made. This ClassAd is currently undocumented.

Return type:

ClassAd