htcondor – HTCondor Reference

This page is an exhaustive reference of the API exposed by the htcondor module. It is not meant to be a tutorial for new users but rather a helpful guide for those who already understand the basic usage of the module.

This reference covers the following:

Common Module-Level Functions and Objects

htcondor.platform()

Returns the platform of HTCondor this module is running on.

htcondor.version()

Returns the version of HTCondor this module is linked against.

htcondor.reload_config()

Reload the HTCondor configuration from disk.

htcondor.enable_debug()

Enable debugging output from HTCondor; output is sent to stderr. The logging level is controlled by the HTCondor configuration variable TOOL_DEBUG.

htcondor.enable_log()

Enable debugging output from HTCondor; output is sent to a file.

The log level and the file used are controlled by the HTCondor configuration variables TOOL_DEBUG and TOOL_LOG, respectively.

htcondor.read_events(file_obj, is_xml = True)

Read and parse an HTCondor event log file.

Parameters:
  • file_obj – A file object corresponding to an HTCondor event log.
  • is_xml (bool) – Specifies whether the event log is XML-formatted.
Returns:

A Python iterator which produces objects of type ClassAd.

Return type:

EventIterator

htcondor.poll(active_queries)

Wait on the results of multiple query iteratories.

This function returns an iterator which yields the next ready query iterator. The returned iterator stops when all results have been consumed for all iterators.

Parameters:active_queries (list[QueryIterator]) – Query iterators as returned by xquery().
Returns:An iterator producing the ready QueryIterator.
Return type:BulkQueryIterator
htcondor.param

Provides dictionary-like access the HTCondor configuration.

An instance of _Param. Upon importing the htcondor module, the HTCondor configuration files are parsed and populate this dictionary-like object.

Module Classes

class htcondor.Schedd

Client object for a remote condor_schedd.

__init__(location_ad=None)

Create an instance of the Schedd class.

Parameters:location_ad (ClassAd) – describes the location of the remote condor_schedd daemon, as returned by the Collector.locate() method. If the parameter is omitted, the local condor_schedd daemon is used.
transaction(flags=0, continue_txn=False)

Start a transaction with the condor_schedd.

Starting a new transaction while one is ongoing is an error unless the continue_txn flag is set.

Parameters:
  • flags (TransactionFlags) – Flags controlling the behavior of the transaction, defaulting to 0.
  • continue_txn (bool) – Set to True if you would like this transaction to extend any pre-existing transaction; defaults to False. If this is not set, starting a transaction inside a pre-existing transaction will cause an exception to be thrown.
Returns:

A transaction context manager object.

query(constraint='true', attr_list=[], callback=None, limit=-1, opts=QueryOpts.Default)

Query the condor_schedd daemon for jobs.

Note

This returns a list of ClassAd objects, meaning all results must be buffered in memory. This may be memory-intensive for large responses; we strongly recommend to utilize the xquery()

Parameters:
  • constraint (str or ExprTree) – Query constraint; only jobs matching this constraint will be returned; defaults to 'true'.
  • attr_list (list[str]) – Attributes for the condor_schedd daemon to project along. At least the attributes in this list will be returned. The default behavior is to return all attributes.
  • callback – A callable object; if provided, it will be invoked for each ClassAd. The return value (if note None) will be added to the returned list instead of the ad.
  • limit (int) – The maximum number of ads to return; the default (-1) is to return all ads.
  • opts (QueryOpts.) – Additional flags for the query; these may affect the behavior of the condor_schedd.
Returns:

ClassAds representing the matching jobs.

Return type:

list[ClassAd]

xquery(requirements='true', projection=[], limit=-1, opts=QueryOpts.Default, name=None)

Query the condor_schedd daemon for jobs.

As opposed to query(), this returns an iterator, meaning only one ad is buffered in memory at a time.

Parameters:
  • requirements (str or ExprTree) – provides a constraint for filtering out jobs. It defaults to 'true'.
  • projection (list[str]) – The attributes to return; an empty list (the default) signifies all attributes.
  • limit (int) – A limit on the number of matches to return. The default (-1) indicates all matching jobs should be returned.
  • opts (QueryOpts) – Additional flags for the query, from QueryOpts.
  • name (str) – A tag name for the returned query iterator. This string will always be returned from the QueryIterator.tag() method of the returned iterator. The default value is the condor_schedd’s name. This tag is useful to identify different queries when using the poll() function.
Returns:

An iterator for the matching job ads

Return type:

QueryIterator

act(action, job_spec)

Change status of job(s) in the condor_schedd daemon. The return value is a ClassAd object describing the number of jobs changed.

This will throw an exception if no jobs are matched by the constraint.

Parameters:
  • action (JobAction) – The action to perform; must be of the enum JobAction.
  • job_spec (list[str] or str) – The job specification. It can either be a list of job IDs or a string specifying a constraint. Only jobs matching this description will be acted upon.
edit(job_spec, attr, value)

Edit one or more jobs in the queue.

This will throw an exception if no jobs are matched by the job_spec constraint.

Parameters:
  • job_spec (list[str] or str) – The job specification. It can either be a list of job IDs or a string specifying a constraint. Only jobs matching this description will be acted upon.
  • attr (str) – The name of the attribute to edit.
  • value (str or ExprTree) – The new value of the attribute. It should be a string, which will be converted to a ClassAd expression, or an ExprTree object. Be mindful of quoting issues; to set the value to the string foo, one would set the value to '"foo"'
history(requirements, projection, match=1)

Fetch history records from the condor_schedd daemon.

Parameters:
  • requirements – Query constraint; only jobs matching this constraint will be returned; defaults to 'true'.
  • projection (list[str]) – Attributes that are to be included for each returned job. The empty list causes all attributes to be included.
  • match (int) – An limit on the number of jobs to include; the default (-1) indicates to return all matching jobs.
Returns:

All matching ads in the Schedd history, with attributes according to the projection keyword.

Return type:

HistoryIterator

submit(ad, count = 1, spool = false, ad_results = None)

Submit one or more jobs to the condor_schedd daemon.

This method requires the invoker to provide a ClassAd for the new job cluster; such a ClassAd contains attributes with different names than the commands in a submit description file. As an example, the stdout file is referred to as output in the submit description file, but Out in the ClassAd.

Hint

To generate an example ClassAd, take a sample submit description file and invoke:

condor_submit -dump <filename> [cmdfile]

Then, load the resulting contents of <filename> into Python.

Parameters:
  • ad (ClassAd) – The ClassAd describing the job cluster.
  • count (int) – The number of jobs to submit to the job cluster. Defaults to 1.
  • spool (bool) – If True, the clinent inserts the necessary attributes into the job for it to have the input files spooled to a remote condor_schedd daemon. This parameter is necessary for jobs submitted to a remote condor_schedd that use HTCondor file transfer.
  • ad_results (list[ClassAd]) – If set to a list, the list object will contain the job ads resulting from the job submission. These are needed for interacting with the job spool after submission.
Returns:

The newly created cluster ID.

Return type:

int

submitMany(cluster_ad, proc_ads, spool = false, ad_results = None)

Submit multiple jobs to the condor_schedd daemon, possibly including several distinct processes.

Parameters:
  • cluster_ad (ClassAd) – The base ad for the new job cluster; this is the same format as in the submit() method.
  • proc_ads (list) – A list of 2-tuples; each tuple has the format of (proc_ad, count). For each list entry, this will result in count jobs being submitted inheriting from both cluster_ad and proc_ad.
  • spool (bool) – If True, the clinent inserts the necessary attributes into the job for it to have the input files spooled to a remote condor_schedd daemon. This parameter is necessary for jobs submitted to a remote condor_schedd that use HTCondor file transfer.
  • ad_results (list[ClassAd]) – If set to a list, the list object will contain the job ads resulting from the job submission. These are needed for interacting with the job spool after submission.
Returns:

The newly created cluster ID.

Return type:

int

spool(ad_list)

Spools the files specified in a list of job ClassAds to the condor_schedd.

Parameters:ad_list (list[ClassAds]) – A list of job descriptions; typically, this is the list filled by the ad_results argument of the submit() method call.
Raises:RuntimeError – if there are any errors.
retrieve(job_spec)

Retrieve the output sandbox from one or more jobs.

Parameters:job_spec (list[ClassAd]) – An expression matching the list of job output sandboxes to retrieve.
refreshGSIProxy(cluster, proc, filename, lifetime)

Refresh the GSI proxy of a job; the job’s proxy will be replaced the contents of the provided filename.

Note

Depending on the lifetime of the proxy in filename, the resulting lifetime may be shorter than the desired lifetime.

Parameters:
  • cluster (int) – Cluster ID of the job to alter.
  • proc (int) – Process ID of the job to alter.
  • lifetime (int) – Indicates the desired lifetime (in seconds) of the delegated proxy. A value of 0 specifies to not shorten the proxy lifetime. A value of -1 specifies to use the value of configuration variable DELEGATE_JOB_GSI_CREDENTIALS_LIFETIME.
negotiate((str)accounting_name)

Begin a negotiation cycle with the remote schedd for a given user.

Note

The returned ScheddNegotiate additionally serves as a context manager, automatically destroying the negotiation session when the context is left.

Parameters:accounting_name (str) – Determines which user the client will start negotiating with.
Returns:An iterator which yields resource request ClassAds from the condor_schedd. Each resource request represents a set of jobs that are next in queue for the schedd for this user.
Return type:ScheddNegotiate
reschedule()

Send reschedule command to the schedd.

class htcondor.Collector

Client object for a remote condor_collector. The interaction with the collector broadly has three aspects:

  • Locating a daemon.
  • Query the collector for one or more specific ClassAds.
  • Advertise a new ad to the condor_collector.
__init__(pool = None)

Create an instance of the Collector class.

Parameters:pool (str or list[str]) – A host:port pair specified for the remote collector (or a list of pairs for HA setups). If omitted, the value of configuration parameter COLLECTOR_HOST is used.
locate(daemon_type, name)

Query the condor_collector for a particular daemon.

Parameters:
  • daemon_type (DaemonTypes) – The type of daemon to locate.
  • name (str) – The name of daemon to locate. If not specified, it searches for the local daemon.
Returns:

a minimal ClassAd of the requested daemon, sufficient only to contact the daemon; typically, this limits to the MyAddress attribute.

Return type:

ClassAd

locateAll(daemon_type)

Query the condor_collector daemon for all ClassAds of a particular type. Returns a list of matching ClassAds.

Parameters:daemon_type (DaemonTypes) – The type of daemon to locate.
Returns:Matching ClassAds
Return type:list[ClassAd]
query(ad_type, constraint='true', attrs=[], statistics='')

Query the contents of a condor_collector daemon. Returns a list of ClassAds that match the constraint parameter.

Parameters:
  • ad_type (AdTypes) – The type of ClassAd to return. If not specified, the type will be ANY_AD.
  • constraint (str or ExprTree) – A constraint for the collector query; only ads matching this constraint are returned. If not specified, all matching ads of the given type are returned.
  • attrs (list[str]) – A list of attributes to use for the projection. Only these attributes, plus a few server-managed, are returned in each ClassAd.
  • statistics (list[str]) – Statistics attributes to include, if they exist for the specified daemon.
Returns:

A list of matching ads.

Return type:

list[ClassAd]

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

Advertise a list of ClassAds into the condor_collector.

Parameters:
  • ad_list (list[ClassAds]) – ClassAds to advertise.
  • command (str) – An advertise command for the remote condor_collector. It defaults to UPDATE_AD_GENERIC. Other commands, such as UPDATE_STARTD_AD, may require different authorization levels with the remote daemon.
  • use_tcp (bool) – When set to true, updates are sent via TCP. Defaults to True.
class htcondor.Submit

An object representing a job submit description. This uses the same submit language as condor_submit.

The submit description contains key = value pairs and implements the python dictionary protocol, including the get, setdefault, update, keys, items, and values methods.

__init__(input = None)

Create an instance of the Submit class.

Parameters:input (dict) – Key = value pairs for initializing the submit description. If omitted, the submit class is initially empty.
expand(attr)

Expand all macros for the given attribute.

Parameters:attr (str) – The name of the relevant attribute.
Returns:The value of the given attribute; all macros are expanded.
Return type:str
queue((object)txn, (int)count = 1, (object)ad_results = None)

Submit the current object to a remote queue.

Parameters:
  • txn (Transaction) – An active transaction object (see Schedd.transaction()).
  • count (int) – The number of jobs to create (defaults to 1).
  • ad_results – A list to receive the ClassAd resulting from this submit. As with Schedd.submit(), this is often used to later spool the input files.
Returns:

The ClusterID of the submitted job(s).

Return type:

int

Raises:

RuntimeError – if the submission fails.

class htcondor.Negotiator

This class provides a query interface to the condor_negotiator; primarily, it allows one to query and set various parameters in the fair-share accounting.

__init__(ad = None)

Create an instance of the Negotiator class.

Parameters:ad (ClassAd) – A ClassAd describing the claim and the condor_negotiator location. If omitted, the default pool negotiator is assumed.
deleteUser(user)

Delete all records of a user from the Negotiator’s fair-share accounting.

Parameters:user (str) – A fully-qualified user name, i.e., USER@DOMAIN.
getPriorities([(bool)rollup = False])

Retrieve the pool accounting information, one per entry.Returns a list of accounting ClassAds.

Parameters:rollup (bool) – Set to True if accounting information, as applied to hierarchical group quotas, should be summed for groups and subgroups.
Returns:A list of accounting ads, one per entity.
Return type:list[ClassAd]
getResourceUsage((str)user)

Get the resources (slots) used by a specified user.

Parameters:user (str) – A fully-qualified user name, USER@DOMAIN.
Returns:List of ads describing the resources (slots) in use.
Return type:list[ClassAd]
resetAllUsage()

Reset all usage accounting. All known user records in the negotiator are deleted.

resetUsage(user)

Reset all usage accounting of the specified user.

Parameters:user (str) – A fully-qualified user name, USER@DOMAIN.
setBeginUsage(user, value)

Manually set the time that a user begins using the pool.

Parameters:
  • user (str) – A fully-qualified user name, USER@DOMAIN.
  • value (int) – The Unix timestamp of initial usage.
setLastUsage(user, value)

Manually set the time that a user last used the pool.

Parameters:
  • user (str) – A fully-qualified user name, USER@DOMAIN.
  • value (int) – The Unix timestamp of last usage.
setFactor(user, factor)

Set the priority factor of a specified user.

Parameters:
  • user (str) – A fully-qualified user name, USER@DOMAIN.
  • factor (float) – The priority factor to be set for the user; must be greater-than or equal-to 1.0.
setPriority(user, prio)

Set the real priority of a specified user.

Parameters:
  • user (str) – A fully-qualified user name, USER@DOMAIN.
  • prio (float) – The priority to be set for the user; must be greater-than 0.0.
setUsage(user, usage)

Set the accumulated usage of a specified user.

Parameters:
  • user (str) – A fully-qualified user name, USER@DOMAIN.
  • usage (float) – The usage, in hours, to be set for the user.
class htcondor.Startd
__init__(ad = None)

Create an instance of the Startd class.

Parameters:ad (ClassAd) – A ClassAd describing the claim and the startd location. If omitted, the local startd is assumed.
cancelDrainJobs(request_id = None)

Cancel a draining request.

Parameters:request_id (str) – Specifies a draining request to cancel. If not specified, all draining requests for this startd are canceled.
class htcondor.SecMan

A class, representing the internal HTCondor security state.

If a security session becomes invalid, for example, because the remote daemon restarts, reuses the same port, and the client continues to use the session, then all future commands will fail with strange connection errors. This is the only mechanism to invalidate in-memory sessions.

The SecMan can also behave as a context manager; when created, the object can be used to set temporary security configurations that only last during the lifetime of the security object.

__init__()

Create a SecMan object.

invalidateAllSessions()

Invalidate all security sessions. Any future connections to a daemon will cause a new security session to be created.

ping(ad, command='DC_NOP')

Perform a test authorization against a remote daemon for a given command.

Parameters:
  • ad (str or ClassAd) – The ClassAd of the daemon as returned by Collector.locate(); alternately, the sinful string can be given directly as the first parameter.
  • command – The DaemonCore command to try; if not given, 'DC_NOP' will be used.
Returns:

An ad describing the results of the test security negotiation.

Return type:

ClassAd

getCommandString(commandInt)

Return the string name corresponding to a given integer command.

setConfig(key, value)

Set a temporary configuration variable; this will be kept for all security sessions in this thread for as long as the SecMan object is alive.

Parameters:
  • key (str) – Configuration key to set.
  • value (str) – Temporary value to set.
setGSICredential(filename)

Set the GSI credential to be used for security negotiation.

Parameters:filename (str) – File name of the GSI credential.
setPoolPassword(new_pass)

Set the pool password

Parameters:new_pass (str) – Updated pool password to use for new security negotiations.
setTag(tag)

Set the authentication context tag for the current thread.

All security sessions negotiated with the same tag will only be utilized when that tag is active.

For example, if thread A has a tag set to Joe and thread B has a tag set to Jane, then all security sessions negotiated for thread A will not be used for thread B.

Parameters:tag (str) – New tag to set.
class htcondor.Claim

The Claim class provides access to HTCondor’s Compute-on-Demand facilities. The class represents a claim of a remote resource; it allows the user to manually activate a claim (start a job) or release the associated resources.

The claim comes with a finite lifetime - the lease. The lease may be extended for as long as the remote resource (the Startd) allows.

__init__(ad)

Create a Claim object of a given remote resource. The ad provides a description of the resource, as returned by Collector.locate().

This only stores the remote resource’s location; it is not contacted until requestCOD() is invoked.

Parameters:ad (ClassAd) – Location of the Startd to claim.
requestCOD(constraint, lease_duration)

Request a claim from the condor_startd represented by this object.

On success, the Claim object will represent a valid claim on the remote startd; other methods, such as activate() should now function.

Parameters:
  • constraint (str) – ClassAd expression that pecifies which slot in the startd should be claimed. Defaults to 'true', which will result in the first slot becoming claimed.
  • lease_duration (int) – Indicates how long the claim should be valid. Defaults to -1, which indicates to lease the resource for as long as the Startd allows.
activate(ad)

Activate a claim using a given job ad.

Parameters:ad – Description of the job to launch; this uses similar, but not identical attribute names as condor_submit. See the HTCondor manual for a description of the job language.
release(vacate_type)

Release the remote condor_startd from this claim; shut down any running job.

Parameters:vacate_type (VacateTypes) – Indicates the type of vacate to perform for the running job.
suspend()

Temporarily suspend the remote execution of the COD application. On Unix systems, this is done using SIGSTOP.

resume()

Resume the temporarily suspended execution. On Unix systems, this is done using SIGCONT.

renew()

Renew the lease on an existing claim. The renewal should last for the value of lease_duration provided to __init__().

deactivate()

Deactivate a claim; shuts down the currently running job, but holds onto the claim for future activation.

delegateGSIProxy(fname)

Send an X509 proxy credential to an activated claim.

Parameters:fname (str) – Filename of the X509 proxy to send to the active claim.
class htcondor.ScheddNegotiate

The ScheddNegotiate class represents an ongoing negotiation session with a schedd. It is a context manager, returned by the negotiate() method.

sendClaim(claim, offer, request)

Send a claim to the schedd; if possible, the schedd will activate this and run one or more jobs.

Parameters:
  • claim (str) – The claim ID, typically from the Capability attribute in the corresponding Startd’s private ad.
  • offer (ClassAd) – A description of the resource claimed (typically, the machine’s ClassAd).
  • request (ClassAd) – The resource request this claim is responding to; if not provided (default), the Schedd will decide which job receives this resource.
disconnect()

Disconnect from this negotiation session. This can also be achieved by exiting the context.

class htcondor._Param

A dictionary-like object for the local HTCondor configuration; the keys and values of this object are the keys and values of the HTCondor configuration.

The get, setdefault, update, keys, items, and values methods of this class have the same semantics as a python dictionary.

Writing to a _Param object will update the in-memory HTCondor configuration.

class htcondor.JobEventLog

An iterable object (and iterable context manager) corresponding to a specific file on disk containing a user event log. By default, it waits for new events, but it may be used to poll for them, as follows:

import htcondor
jel = htcondor.JobEventLog("file.log")
# Read all currently-available events without blocking.
for event in jel.events(0):
    print(event)
else:
    print("We found the the end of file")
__init__(filename)

Create an instance of the JobEventLog class.

Parameters:filename – Filename of the job event log.
events(stop_after=None)

Return an iterator (self), which yields JobEvent objects. The iterator may yield any number of events, including zero, before throwing StopIteration, which signals end-of-file. You may iterate again with the same JobEventLog to check for new events.

Parameters:stop_after – Stop waiting for new events after this many seconds. If None, never stop waiting for new events. If 0, do not wait for new events.
close()

Closes any open underlying file. Subsequent iterations on this JobEventLog object will immediately terminate (will never return another JobEvent).

class htcondor.JobEvent

An immutable dictionary-like object corresponding to a particular event in the user log. All events define the following attributes. Other type-specific attributes are keys of the dictionary. JobEvent objects support both in operators (if "attribute" in jobEvent and for attributeName in jobEvent) and may be passed as arguments to len.

Note

Although the attribute type is a JobEventType type, when acting as dictionary, a JobEvent object returns types as if it were a ClassAd, so comparisons to enumerated values must use the == operator. (No current event type has ExprTree values.)

type
Type:htcondor.JobEventType

The event type.

cluster

The cluster ID.

proc

The proc ID.

timestamp

When the event was recorded.

Esoteric Module-Level Functions

htcondor.send_command(ad, dc, target = None)

Send a command to an HTCondor daemon specified by a location ClassAd.

Parameters:
  • ad (ClassAd) – Specifies the location of the daemon (typically, found by using Collector.locate().
  • dc (DaemonCommands) – A command type
  • target (str) – An additional command to send to a daemon. Some commands require additional arguments; for example, sending DaemonOff to a condor_master requires one to specify which subsystem to turn off.
htcondor.send_alive(ad, pid = None, timeout = -1)

Send a keep alive message to an HTCondor daemon.

This is used when the python process is run as a child daemon under the condor_master.

Parameters:
  • ad (ClassAd) – A ClassAd specifying the location of the daemon. This ad is typically found by using Collector.locate().
  • pid (int) – The process identifier for the keep alive. The default value of None uses the value from os.getpid().
  • timeout (int) – The number of seconds that this keep alive is valid. If a new keep alive is not received by the condor_master in time, then the process will be terminated. The default value is controlled by configuration variable NOT_RESPONDING_TIMEOUT.
htcondor.set_subsystem(name, daemon_type = Auto)

Set the subsystem name for the object.

The subsystem is primarily used for the parsing of the HTCondor configuration file.

Parameters:
  • name (str) – The subsystem name.
  • daemon_type (SubsystemType) – The HTCondor daemon type. The default value of Auto infers the type from the name parameter.
htcondor.lock(file_obj, lock_type)

Take a lock on a file object using the HTCondor locking protocol (distinct from typical POSIX locks).

Parameters:
  • file_obj (file) – is a file object corresponding to the file which should be locked.
  • lock_type (LockType) – The kind of lock to acquire.
Returns:

A context manager object; the lock is released when the context manager object is exited.

Return type:

FileLock

htcondor.log(level, msg)

Log a message using the HTCondor logging subsystem.

Parameters:
  • level (LogLevel) – The Log category and formatting indicator. Multiple LogLevel enum attributes may be OR’d together.
  • msg (str) – A message to log.

Iterator and Helper Classes

class htcondor.HistoryIterator

An iterator class for managing results of the Schedd.history() method.

next()
Returns:the next available history ad.
Return type:ClassAd
Raises:StopIteration – when no additional ads are available.
class htcondor.QueryIterator

An iterator class for managing results of the Schedd.query() and Schedd.xquery() methods.

next(mode=BlockingMode.Blocking)
Parameters:mode (BlockingMode) – The blocking mode for this call to next(); defaults to Blocking.
Returns:the next available job ad.
Return type:ClassAd
Raises:StopIteration – when no additional ads are available.
nextAdsNonBlocking()

Retrieve as many ads are available to the iterator object.

If no ads are available, returns an empty list. Does not throw an exception if no ads are available or the iterator is finished.

Returns:Zero-or-more job ads.
Return type:list[ClassAd]
tag()

Retrieve the tag associated with this iterator; when using the poll() method, this is useful to distinguish multiple iterators.

Returns:the query’s tag.
done()
Returns:True if the iterator is finished; False otherwise.
watch()

Returns an inotify-based file descriptor; if this descriptor is given to a select() instance, select will indicate this file descriptor is ready to read whenever there are more jobs ready on the iterator.

If inotify is not available on this platform, this will return -1.

Returns:A file descriptor associated with this query.
Return type:int
class htcondor.BulkQueryIterator

Returned by poll(), this iterator produces a sequence of QueryIterator objects that have ads ready to be read in a non-blocking manner.

Once there are no additional available iterators, poll() must be called again.

next()
Returns:The next available QueryIterator that can be read without blocking.
Return type:QueryIterator
Raises:StopIteration – if no more iterators are ready.
class htcondor.FileLock

A context manager object created by the lock() function; upon exit from the context, it will release the lock.

Useful Enumerations

class htcondor.DaemonTypes

An enumeration of different types of daemons available to HTCondor.

Collector

Ads representing the condor_collector.

Negotiator

Ads representing the condor_negotiator.

Schedd

Ads representing the condor_schedd.

Startd

Ads representing the resources on a worker node.

HAD

Ads representing the high-availability daemons (condor_had).

Master

Ads representing the condor_master.

Generic

All other ads that are not categorized as above.

Any

Any type of daemon; useful when specifying queries where all matching daemons should be returned.

class htcondor.AdTypes

A list of different types of ads that may be kept in the condor_collector.

Any

Type representing any matching ad. Useful for queries that match everything in the collector.

Collector

Ads from the condor_collector daemon.

Generic

Generic ads, associated with no particular daemon.

Grid

Ads associated with the grid universe.

HAD

Ads produced by the condor_had.

License

License ads. These do not appear to be used by any modern HTCondor daemon.

Master

Master ads, produced by the condor_master daemon.

Negotiator

Negotiator ads, produced by the condor_negotiator daemon.

Schedd

Schedd ads, produced by the condor_schedd daemon.

Startd

Startd ads, produced by the condor_startd daemon. Represents the available slots managed by the startd.

StartdPrivate

The “private” ads, containing the claim IDs associated with a particular slot. These require additional authorization to read as the claim ID may be used to run jobs on the slot.

Submitter

Ads describing the submitters with available jobs to run; produced by the condor_schedd and read by the condor_negotiator to determine which users need a new negotiation cycle.

class htcondor.JobAction

Different actions that may be performed on a job in queue.

Hold

Put a job on hold, vacating a running job if necessary. A job will stay in the hold state until explicitly acted upon by the admin or owner.

Release

Release a job from the hold state, returning it to Idle.

Suspend

Suspend the processes of a running job (on Unix platforms, this triggers a SIGSTOP). The job’s processes stay in memory but no longer get scheduled on the CPU.

Continue

Continue a suspended jobs (on Unix, SIGCONT). The processes in a previously suspended job will be scheduled to get CPU time again.

Remove

Remove a job from the Schedd’s queue, cleaning it up first on the remote host (if running). This requires the remote host to acknowledge it has successfully vacated the job, meaning Remove may not be instantaneous.

RemoveX

Immediately remove a job from the schedd queue, even if it means the job is left running on the remote resource.

Vacate

Cause a running job to be killed on the remote resource and return to idle state. With Vacate, jobs may be given significant time to cleanly shut down.

VacateFast

Vacate a running job as quickly as possible, without providing time for the job to cleanly terminate.

class htcondor.DaemonCommands

Various state-changing commands that can be sent to to a HTCondor daemon using send_command().

DaemonOff
DaemonOffFast
DaemonOffPeaceful
DaemonsOff
DaemonsOffFast
DaemonsOffPeaceful
OffFast
OffForce
OffGraceful
OffPeaceful
Reconfig
Restart
RestartPeacful
SetForceShutdown
SetPeacefulShutdown
class htcondor.TransactionFlags

Flags affecting the characteristics of a transaction.

NonDurable

Non-durable transactions are changes that may be lost when the condor_schedd crashes. NonDurable is used for performance, as it eliminates extra fsync() calls.

SetDirty

This marks the changed ClassAds as dirty, causing an update notification to be sent to the condor_shadow and the condor_gridmanager, if they are managing the job.

ShouldLog

Causes any changes to the job queue to be logged in the relevant job event log.

class htcondor.QueryOpts

Flags sent to the condor_schedd during a query to alter its behavior.

Default

Queries should use all default behaviors.

AutoCluster

Instead of returning job ads, return an ad per auto-cluster.

class htcondor.BlockingMode

Controls the behavior of query iterators once they are out of data.

Blocking

Sets the iterator to block until more data is available.

NonBlocking

Sets the iterator to return immediately if additional data is not available.

class htcondor.DrainTypes

Draining policies that can be sent to a condor_startd.

Fast
Graceful
Quick
class htcondor.VacateTypes

Vacate policies that can be sent to a condor_startd.

Fast
Graceful
class htcondor.LockType

Lock policies that may be taken.

ReadLock
WriteLock
class htcondor.SubsystemType

An enumeration of known subsystem names.

Collector
Daemon
Dagman
GAHP
Job
Master
Negotiator
Schedd
Shadow
SharedPort
Startd
Starter
Submit
Tool
class htcondor.LogLevel

The log level attribute to use with log(). Note that HTCondor mixes both a class (debug, network, all) and the header format (Timestamp, PID, NoHeader) within this enumeration.

Always
Audit
Config
DaemonCore
Error
FullDebug
Hostname
Job
Machine
Network
NoHeader
PID
Priv
Protocol
Security
Status
SubSecond
Terse
Timestamp
Verbose
class htcondor.JobEventType

The type event of a user log event; corresponds to ULogEventNumber in the C++ source.

SUBMIT
EXECUTE
EXECUTABLE_ERROR
CHECKPOINTED
JOB_EVICTED
JOB_TERMINATED
IMAGE_SIZE
SHADOW_EXCEPTION
GENERIC
JOB_ABORTED
JOB_SUSPENDED
JOB_UNSUSPENDED
JOB_HELD
JOB_RELEASED
NODE_EXECUTE
NODE_TERMINATED
POST_SCRIPT_TERMINATED
GLOBUS_SUBMIT
GLOBUS_SUBMIT_FAILED
GLOBUS_RESOURCE_UP
GLOBUS_RESOURCE_DOWN
REMOTE_ERROR
JOB_DISCONNECTED
JOB_RECONNECTED
JOB_RECONNECT_FAILED
GRID_RESOURCE_UP
GRID_RESOURCE_DOWN
GRID_SUBMIT
JOB_AD_INFORMATION
JOB_STATUS_UNKNOWN
JOB_STATUS_KNOWN
JOB_STAGE_IN
JOB_STAGE_OUT
ATTRIBUTE_UPDATE
PRESKIP
CLUSTER_SUBMIT
CLUSTER_REMOVE
FACTORY_PAUSED
FACTORY_RESUMED
NONE
FILE_TRANSFER