htcondor2.personal API Reference
- class htcondor2.personal.PersonalPool(local_dir=None, config=None, raw_config=None, detach=False, use_config=True)
A
PersonalPoolis 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]) – 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]) – 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 toFalse.use_config (bool) – If
True, the environment variableCONDOR_CONFIGwill 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 thePersonalPoolobject. The personal pool will also be initialized. Defaults toTrue.
- classmethod attach(local_dir=None) PersonalPool
Make a new
PersonalPoolattached to an existing personal pool that is already running inlocal_dir.
- property collector
The
htcondor.Collectorfor the personal pool’s collector.
- detach() PersonalPool
Detach the personal pool (as in the constructor argument), and return
self.
- get_config_val(macro, default=None) str
Get the value of a configuration macro. The value will be “evaluated”, meaning that other configuration macros or functions inside it will be expanded.
- initialize(overwrite_config=True) PersonalPool
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. IfFalseand there is an existing configuration file, an exception will be raised. Defaults toTrue.- Returns
self – This method returns
self.- Return type
- run_command(args, stdout=-1, stderr=-1, universal_newlines=True, **kwargs) CompletedProcess
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 tosubprocess.run().- Parameters
args (List[str]) – The command to run, and its arguments, as a list of strings.
kwargs – All keyword arguments (including
stdout,stderr, anduniversal_newlines) are passed tosubprocess.run().
- Returns
completed_process
- Return type
- property schedd
The
htcondor.Scheddfor the personal pool’s schedd.
- start() PersonalPool
Start the personal condor (bringing it to the
READYstate from eitherUNINITIALIZEDorINITIALIZED).- Returns
self – This method returns
self.- Return type
- property state
The current
PersonalPoolStateof the personal pool.
- stop()
Stop the personal condor, bringing it from the
READYstate toSTOPPED.- Returns
self – This method returns
self.- Return type
- use_config()
Returns a
SetCondorConfigcontext manager that setsCONDOR_CONFIGto point to the configuration file for this personal pool.
- class htcondor2.personal.PersonalPoolState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
-
An enumeration of the possible states that a
PersonalPoolcan be in.- UNINITIALIZED = 'UNINITIALIZED'
- INITIALIZED = 'INITIALIZED'
- STARTING = 'STARTING'
- READY = 'READY'
- STOPPING = 'STOPPING'
- STOPPED = 'STOPPED'
- class htcondor2.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.