htcondor.personal API Reference

class htcondor.personal.PersonalPool(local_dir=None, config=None, raw_config=None, detach=False, use_config=True)

A PersonalPool is responsible for managing the lifecycle of a personal HTCondor pool. It can be used to start and stop a personal pool, and can also “attach” to an existing personal pool that is already running.

Parameters
  • local_dir (Optional[Path, None]) – The local directory for the personal HTCondor pool. All configuration and state for the personal pool will be stored in this directory.

  • config (Mapping[str, str]) – HTCondor configuration parameters to inject, as a mapping of key-value pairs.

  • raw_config (Optional[str, None]) – Raw HTCondor configuration language to inject, as a string.

  • detach (bool) – If True, the personal HTCondor pool will not be shut down when this object is destroyed (e.g., by stopping Python). Defaults to False.

  • use_config (bool) – If True, the environment variable CONDOR_CONFIG will be set during initialization, such that this personal pool appears to be the local HTCondor pool for all operations in this Python session, even ones that don’t go through the PersonalPool object. The personal pool will also be initialized. Defaults to True.

classmethod attach(local_dir=None)

Make a new PersonalPool attached to an existing personal pool that is already running in local_dir.

Parameters

local_dir (Optional[Path, None]) – The local directory for the existing personal pool.

Returns

self – This method returns self.

Return type

PersonalPool

property collector

The htcondor.Collector for the personal pool’s collector.

detach()

Detach the personal pool (as in the constructor argument), and return self.

Return type

PersonalPool

get_config_val(macro, default=None)

Get the value of a configuration macro. The value will be “evaluated”, meaning that other configuration macros or functions inside it will be expanded.

Parameters
  • macro (str) – The configuration macro to look up the value for.

  • default (Optional[str, None]) – If not None, and the config macro has no value, return this instead. If None, a KeyError will be raised instead.

Returns

value – The evaluated value of the configuration macro.

Return type

str

initialize(overwrite_config=True)

Initialize the personal pool by creating its local directory and writing out configuration files.

The contents of the local directory (except for the configuration file if overwrite_config=True) will not be overridden.

Parameters

overwrite_config – If True, the existing configuration file will be overwritten with the configuration set up in the constructor. If False and there is an existing configuration file, an exception will be raised. Defaults to True.

Returns

self – This method returns self.

Return type

PersonalPool

run_command(args, stdout=-1, stderr=-1, universal_newlines=True, **kwargs)

Execute a command in a subprocess against this personal pool, using subprocess.run() with good defaults for executing HTCondor commands. All of the keyword arguments of this function are passed directly to subprocess.run().

Parameters
  • args (List[str]) – The command to run, and its arguments, as a list of strings.

  • kwargs – All keyword arguments (including stdout, stderr, and universal_newlines) are passed to subprocess.run().

Returns

completed_process

Return type

subprocess.CompletedProcess

property schedd

The htcondor.Schedd for the personal pool’s schedd.

start()

Start the personal condor (bringing it to the READY state from either UNINITIALIZED or INITIALIZED).

Returns

self – This method returns self.

Return type

PersonalPool

property state

The current PersonalPoolState of the personal pool.

stop()

Stop the personal condor, bringing it from the READY state to STOPPED.

Returns

self – This method returns self.

Return type

PersonalPool

use_config()

Returns a SetCondorConfig context manager that sets CONDOR_CONFIG to point to the configuration file for this personal pool.

who()

Return the result of condor_who -quick, as a classad.ClassAd. If condor_who -quick fails, or the output can’t be parsed into a sensible who ad, this method returns an empty ad.

Return type

ClassAd

class htcondor.personal.PersonalPoolState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: str, Enum

An enumeration of the possible states that a PersonalPool can be in.

UNINITIALIZED = 'UNINITIALIZED'
INITIALIZED = 'INITIALIZED'
STARTING = 'STARTING'
READY = 'READY'
STOPPING = 'STOPPING'
STOPPED = 'STOPPED'
class htcondor.personal.SetCondorConfig(config_file)

A context manager. Inside the block, the Condor config file is the one given to the constructor. After the block, it is reset to whatever it was before the block was entered.

Parameters

config_file (Path) – The path to an HTCondor configuration file.