pyiron_base.jobs.job.extension.server.generic.Server#
- class pyiron_base.jobs.job.extension.server.generic.Server(host: str | None = None, queue: str | None = None, cores: int = 1, threads: int = 1, gpus: int | None = None, run_mode: str = 'modal', new_hdf: bool = True, accept_crash: bool = False, run_time: int | None = None, memory_limit: str | None = None, qid: int | None = None, additional_arguments: dict = {}, conda_environment_name: str | None = None, conda_environment_path: str | None = None)[source]#
-
Generic Server object to handle the execution environment for the job
- Parameters:
host (str) – hostname of the local machine
queue (str) – queue name of the currently selected queue
cores (int) – number of cores
run_mode (pyiron_base.server.runmode.Runmode) – mode of the job [‘modal’, ‘non_modal’, ‘queue’, ‘manual’]
new_hdf (bool) – create a new HDF5 file [True/False] - default=True
accept_crash (bool) – ignore execution errors raised by external executables - default False
run_time (int) – run time limit in seconds for the job to finish - required for HPC job schedulers
memory_limit (str) – memory required
qid (int) – Queuing system ID - ID received from the HPC job scheduler
additional_arguments (dict) – Additional arguments for the HPC job scheduler
conda_environment_name (str) – Name of the conda environment
conda_environment_path (str) – Path to the conda environment
- .. attribute:: host
the hostname of the current system.
- .. attribute:: queue
the queue selected for a current simulation.
- .. attribute:: cores
the number of cores selected for the current simulation.
- .. attribute:: run_time
the run time in seconds selected for the current simulation.
- .. attribute:: run_mode
the run mode of the job [‘modal’, ‘non_modal’, ‘queue’, ‘manual’]
- .. attribute:: memory_limit
the maximum amount of RAM allocated for the calculation in GB
- .. attribute:: new_hdf
defines whether a subjob should be stored in the same HDF5 file or in a new one.
- .. attribute:: executor
the executor can be used to execute the job object
- .. attribute:: future
the concurrent.futures.Future object for monitoring the execution of the job object
- __init__(host: str | None = None, queue: str | None = None, cores: int = 1, threads: int = 1, gpus: int | None = None, run_mode: str = 'modal', new_hdf: bool = True, accept_crash: bool = False, run_time: int | None = None, memory_limit: str | None = None, qid: int | None = None, additional_arguments: dict = {}, conda_environment_name: str | None = None, conda_environment_path: str | None = None)[source]#
Methods
__init__([host, queue, cores, threads, ...])db_entry()connect all the info regarding the server into a single word that can be used e.g. as entry in a database.
from_dict(obj_dict[, version])Populate the object from the serialized object.
from_hdf(hdf[, group_name])Recover Server object in HDF5 file :param hdf: HDF5 object :param group_name: node name in the HDF5 file
instantiate(obj_dict[, version])Create a blank instance of this class.
List the available Job scheduler provided by the system.
lock([method])Set
read_only.to_dict()Reduce the object to a dictionary.
to_hdf(hdf[, group_name])Store Server object in HDF5 file :param hdf: HDF5 object :param group_name: node name in the HDF5 file :type group_name: str
unlocked()Unlock the object temporarily.
List the available Job scheduler provided by the system.
Attributes
accept_crashadditional_argumentsGet name of the conda environment the job should be executed in.
Get path of the conda environment the job should be executed in.
The number of cores selected for the current simulation
Executor to execute the job object this server object is attached to in the background.
Python concurrent.futures.Future object to track the status of the execution of the job this server object is attached to.
Total number of GPUs to use for this calculation.
memory_limitNew_hdf5 defines whether a subjob should be stored in the same HDF5 file or in a new one.
The que selected for a current simulation
Get the queue ID - the ID in the queuing system is most likely not the same as the job ID.
List the available Job scheduler provided by the system.
List the available Job scheduler provided by the system.
False if the object can currently be written to
Get the run mode of the job
The run time in seconds selected for the current simulation
The number of threads selected for the current simulation
- property conda_environment_name: str#
Get name of the conda environment the job should be executed in.
- Returns:
name of the conda environment
- Return type:
str
- property conda_environment_path: str#
Get path of the conda environment the job should be executed in.
- Returns:
path of the conda environment
- Return type:
str
- property cores: int#
The number of cores selected for the current simulation
- Returns:
number of cores
- Return type:
(int)
- db_entry() str[source]#
connect all the info regarding the server into a single word that can be used e.g. as entry in a database
- Returns:
server info as single word
- Return type:
(str)
- property executor: Executor | None#
Executor to execute the job object this server object is attached to in the background.
- Return type:
concurrent.futures.Executor
- from_dict(obj_dict: dict, version: str = None)#
Populate the object from the serialized object.
- Parameters:
obj_dict (dict) – data previously returned from
to_dict()version (str) – version tag written together with the data
- from_hdf(hdf: pyiron_base.storage.hdfio.ProjectHDFio, group_name: str | None = None) None[source]#
Recover Server object in HDF5 file :param hdf: HDF5 object :param group_name: node name in the HDF5 file
- property future: Future | None#
Python concurrent.futures.Future object to track the status of the execution of the job this server object is attached to. This is an internal pyiron feature and most users never have to interact with the future object directly.
- Returns:
future object to track the status of the execution
- Return type:
concurrent.futures.Future
- property gpus: int | None#
Total number of GPUs to use for this calculation.
- Returns:
Total number of GPUs to use for this calculation.
- Return type:
int
- classmethod instantiate(obj_dict: dict, version: str = None) Self#
Create a blank instance of this class.
This can be used when some values are already necessary for the objects __init__.
- Parameters:
obj_dict (dict) – data previously returned from
to_dict()version (str) – version tag written together with the data
- Returns:
a blank instance of the object that is sufficiently initialized to call
_from_dict()on it- Return type:
object
- static list_queues() list[source]#
List the available Job scheduler provided by the system.
- Returns:
(list)
- lock(method: Literal['error', 'warning'] | None = None)#
Set
read_only.Objects may be safely locked multiple times without further effect.
- Parameters:
method (str, either "error" or "warning") – if “error” raise an
Lockedexception if modification is attempted; if “warning” raise aLockedWarningwarning; default is “error” or the value passed to the constructor.- Raises:
ValueError – if method is not an allowed value
- property new_hdf: bool#
New_hdf5 defines whether a subjob should be stored in the same HDF5 file or in a new one.
- Returns:
[True / False]
- Return type:
(bool)
- property queue: str | None#
The que selected for a current simulation
- Returns:
schedulers_name
- Return type:
(str)
- property queue_id: int#
Get the queue ID - the ID in the queuing system is most likely not the same as the job ID.
- Returns:
queue ID
- Return type:
int
- property queue_list: list#
List the available Job scheduler provided by the system.
- Returns:
(list)
- property queue_view: DataFrame#
List the available Job scheduler provided by the system.
- Returns:
(pandas.DataFrame)
- property read_only: bool#
False if the object can currently be written to
Setting this value will trigger
_on_lock()and_on_unlock()if it changes.- Type:
bool
- property run_mode: str#
Get the run mode of the job
- Returns:
- [‘modal’, ‘non_modal’, ‘queue’, ‘manual’, ‘thread’, ‘worker’,
’interactive’, ‘interactive_non_modal’, ‘srun’, ‘executor’]
- Return type:
(str/pyiron_base.server.runmode.Runmode)
- property run_time: int#
The run time in seconds selected for the current simulation
- Returns:
run time in seconds
- Return type:
(int)
- property threads: int#
The number of threads selected for the current simulation
- Returns:
number of threads
- Return type:
(int)
- to_dict() dict#
Reduce the object to a dictionary.
- Returns:
serialized state of this object
- Return type:
dict
- to_hdf(hdf: pyiron_base.storage.hdfio.ProjectHDFio, group_name: str | None = None) None[source]#
Store Server object in HDF5 file :param hdf: HDF5 object :param group_name: node name in the HDF5 file :type group_name: str
- unlocked() _UnlockContext#
Unlock the object temporarily.
Context manager returns this object again and relocks it after the with statement finished.
Note
lock() vs. unlocked()
There is a small asymmetry between these two methods.
lock()can only be done once (meaningfully), whileunlocked()is a context manager and can be called multiple times.