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
]) – The local directory for the personal HTCondor pool. All configuration and state for the personal pool will be stored in this directory.config (
Optional
[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
) – IfTrue
, the personal HTCondor pool will not be shut down when this object is destroyed (e.g., by stopping Python). Defaults toFalse
.use_config (
bool
) – IfTrue
, the environment variableCONDOR_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 thePersonalPool
object. The personal pool will also be initialized. Defaults toTrue
.
- classmethod attach(local_dir=None)¶
Make a new
PersonalPool
attached to an existing personal pool that is already running inlocal_dir
.
- 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
- 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.
- 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. IfFalse
and 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)¶
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.Schedd
for the personal pool’s schedd.
- start()¶
Start the personal condor (bringing it to the
READY
state from eitherUNINITIALIZED
orINITIALIZED
).- Returns
self – This method returns
self
.- Return type
- property state¶
The current
PersonalPoolState
of the personal pool.
- stop()¶
Stop the personal condor, bringing it from the
READY
state toSTOPPED
.- Returns
self – This method returns
self
.- Return type
- use_config()¶
Returns a
SetCondorConfig
context manager that setsCONDOR_CONFIG
to point to the configuration file for this personal pool.
- who()¶
Return the result of
condor_who -quick
, as aclassad.ClassAd
. Ifcondor_who -quick
fails, or the output can’t be parsed into a sensible who ad, this method returns an empty ad.- Return type
- class htcondor.personal.PersonalPoolState(value)¶
-
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.