Schedd Class
- class htcondor2.Schedd(location=None)
Client object for a condor_schedd.
- Parameters
location (ClassAd) – A
classad2.ClassAdspecifying a remote condor_schedd daemon, as returned byCollector.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 (Union[List[str], str, ExprTree, int]) – Which job(s) to act on. A
strof the formclusterID[.procID], alistof such strings, aclassad2.ExprTreeconstraint, the the string form of such a constraint, or theintcluster 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
- daemonHistory(constraint=None, projection=[], match=-1, since=None) List[ClassAd]
Query this schedd’s historical records from its local daemon history file.
- Parameters
constraint (Optional[Union[str, ExprTree]]) – A query constraint. Only ClassAds matching this constraint will be returned.
Nonewill 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.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
- edit(job_spec, attr, value, flags=TransactionFlag.Default) int
Change the value of an attribute in zero or more jobs.
- Parameters
job_spec (Union[List[str], str, ExprTree, int]) – Which job(s) to act on. A
strof the formclusterID[.procID], alistof such strings, aclassad2.ExprTreeconstraint, the the string form of such a constraint, or theintcluster ID.attr (str) – Which attribute to change.
value (Union[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
- 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 (Union[List[str], str, ExprTree, int]) – Which job(s) to act on. A
strof the formclusterID[.procID], alistof such strings, aclassad2.ExprTreeconstraint, the the string form of such a constraint, or theintcluster 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
- get_claims(constraint=None, projection=[]) List[ClassAd]
Query the schedd for the list of classads that represent claimed slots
- history(constraint=None, projection=[], match=-1, since=None) List[ClassAd]
Query this schedd’s job history.
- Parameters
constraint (Optional[Union[str, ExprTree]]) – A query constraint. Only jobs matching this constraint will be returned.
Nonewill 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 (Union[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,1038and"clusterID == 1038"return the same set of jobs.If
None, return all (matching) jobs.
- Returns
List of ClassAds.
- Return type
- import_exported_job_results(import_dir) ClassAd
Import results from previously exported jobs, and take those jobs back out of the externally managed state.
- jobEpochHistory(constraint=None, projection=[], match=-1, since=None, **kwargs) List[ClassAd]
Query this schedd’s job epoch history.
- Parameters
constraint (Optional[Union[str, ExprTree]]) – A query constraint. Only jobs matching this constraint will be returned.
Nonewill 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 (Union[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,1038and"clusterID == 1038"return the same set of jobs.If
None, return all (matching) jobs.
- Returns
List of ClassAds.
- Return type
- query(constraint='True', projection=[], callback=None, limit=-1, opts=QueryOpt.Default) List[ClassAd]
Query the condor_schedd daemon for job ads.
- Parameters
constraint (Union[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 (Union[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 (Union[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.
- 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
0to avoid changing the proxy’s lifetime. Specify-1to use the value specific by DELEGATE_JOB_GSI_CREDENTIALS_LIFETIME.
- Returns
The remaining lifetime.
- Return type
- 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.
- spool(result) None
Upload the input files corresponding to a given
submit()for which thespoolflag was set.
- submit(description, count= 0, spool= False, itemdata= <object object>, queue= None) SubmitResult
Submit one or more jobs.
Note
This function presently uses
warningsto 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 *.dathas a count of 3. If specified, this parameter overrides the count indescription.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, usingspool().itemdata (Optional[Union[Iterator[str], Iterator[dict]]]) – 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 withitemdataand/orcount. (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 (Union[List[str], str, ExprTree, int]) – Which job(s) to act on. A
strof the formclusterID[.procID], alistof such strings, aclassad2.ExprTreeconstraint, the the string form of such a constraint, or theintcluster ID.- Returns
A ClassAd containing information about the unexport operation. This type of ClassAd is currently undocumented.
- Return type