Schedd
Class
- class htcondor2.Schedd(location=None)
Client object for a condor_schedd.
- Parameters
location (
ClassAd
) – Aclassad2.ClassAd
specifying 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)
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
]) – Which job(s) to act on. Either astr
of the formclusterID.procID
, alist
of such strings, or aclassad2.ExprTree
constraint, or the string form of such a constraint.reason (
str
) – A free-form justification. Defaults to “Python-initiated action”.
- Return type
- Returns
A ClassAd describing the number of jobs changed. This ClassAd is currently undocumented.
- edit(job_spec, attr, value, flags=TransactionFlag.Default)
Change the value of an attribute in zero or more jobs.
- Parameters
job_spec (
Union
[List
[str
],str
,ExprTree
]) – Which job(s) to edit. Either astr
of the formclusterID.procID
, alist
of such strings, or aclassad2.ExprTree
constraint, or the string form of such a constraint.attr (
str
) – Which attribute to change.value (
Union
[str
,ExprTree
]) – The new value for the attribute.flags (
TransactionFlag
) – Optional flags specifying alternate transaction behavior.
- Return type
- Returns
The number of jobs that were edited.
- export_jobs(job_spec, export_dir, new_spool_dir)
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
]) – Which job(s) to export. Either astr
of the formclusterID.procID
, alist
of such strings, or aclassad2.ExprTree
constraint, or the string form of such a constraint.export_dir (
str
) – Write the exported job(s) into this directory.new_spool_dir (
str
) – The IWD of the export job(s).
- Return type
- Returns
A ClassAd containing information about the export operation. This type of ClassAd is currently undocumented.
- history(constraint=None, projection=[], match=-1, since=None)
Query this schedd’s job history.
- Parameters
constraint (
Union
[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 (
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,1038
and"clusterID == 1038"
return the same set of jobs.If
None
, return all (matching) jobs.
- Return type
- import_exported_job_results(import_dir)
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)
Query this schedd’s job epoch history.
- Parameters
constraint (
Union
[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 (
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,1038
and"clusterID == 1038"
return the same set of jobs.If
None
, return all (matching) jobs.
- Return type
- query(constraint='True', projection=[], callback=None, limit=-1, opts=QueryOpt.Default)
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.
- Return type
- refreshGSIProxy(proc, proxy_filename, lifetime=-1)
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. Specify0
to avoid changing the proxy’s lifetime. Specify-1
to use the value specific by DELEGATE_JOB_GSI_CREDENTIALS_LIFETIME.
- Return type
- Returns
The remaining lifetime.
- reschedule()
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.
- Return type
- spool(result)
Upload the input files corresponding to a given
submit()
for which thespool
flag was set.- Return type
- submit(description, count=0, spool=False, itemdata=<object object>)
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 indescription
.spool (
bool
) – IfTrue
, 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 (
Union
[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.
- Return type
- unexport_jobs(job_spec)
Unexport one or more job clusters that were previously exported from the queue.
- Parameters
job_spec (
Union
[List
[str
],str
,ExprTree
]) – Which job(s) to unexport. Either astr
of the formclusterID.procID
, alist
of such strings, or aclassad2.ExprTree
constraint, or the string form of such a constraint.- Return type
- Returns
A ClassAd containing information about the unexport operation. This type of ClassAd is currently undocumented.