Servers
ropt.plugins.server.default.DefaultServerPlugin
Bases: ServerPlugin
The default plugin for creating evaluators.
This plugin acts as a factory for the standard server implementations
provided by ropt.
Supported Servers:
async_server: Server that forwards calculations to an evaluation function. (DefaultAsyncServer)multiprocessing_server: Server that forwards calculations to a a pool of multiprocessing workers. (DefaultMultiprocessingEvaluatorServer)hpc_server: Server that forwards calculations to a HPC cluster. (DefaultHPCServer)
ropt.plugins.server._async_server.DefaultAsyncServer
Bases: ServerBase
An evaluator server that employs asynchronous workers.
__init__
start
async
Start the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_group
|
TaskGroup
|
The task group to use. |
required |
ropt.plugins.server._multiprocessing_server.DefaultMultiprocessingServer
Bases: ServerBase
An evaluator server that employs a pool of multiprocessing workers.
__init__
start
async
Start the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_group
|
TaskGroup
|
The task group to use. |
required |
ropt.plugins.server._hpc_server.DefaultHPCServer
Bases: ServerBase
A server for submitting tasks to a High-Performance Computing (HPC) cluster.
This server interfaces with an HPC queueing system (like Slurm) via the pysqa
library. It manages the entire lifecycle of a remote task, including:
- Serializing the task (function and arguments) and writing it to a shared filesystem.
- Submitting the task as a job to the HPC queue.
- Polling the queue for the job's status.
- Retrieving the results (or any exceptions) once the job is complete.
Configuration of the cluster connection is handled either through a submission
script template or a pysqa configuration directory.
__init__
__init__(
*,
workdir: Path | str = "./",
workers: int = 1,
queue_size: int = 0,
interval: float = 1,
queue_type: str = "slurm",
template: str | None = None,
config_path: Path | str | None = None,
cluster: str | None = None,
) -> None
Initialize the HPC server.
This sets up the server for communication with an HPC cluster. The connection can be configured in two ways:
- By providing a
templatestring for the job submission script. - By providing a
config_pathto a directory containingpysqacluster configurations.
If config_path is not given, the server will look for a default
configuration at <sysconfig_data>/share/ropt/pysqa. One of these
configuration methods is required.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workdir
|
Path | str
|
Working directory on a shared filesystem accessible by both the client and the HPC nodes. Used for temporary input/output files. |
'./'
|
workers
|
int
|
The maximum number of concurrent jobs to run on the HPC cluster. |
1
|
queue_size
|
int
|
The maximum number of tasks to hold in the internal queue before submission. A value of 0 means an unlimited size. |
0
|
interval
|
float
|
The interval in seconds at which to poll the HPC queue for job status updates. |
1
|
queue_type
|
str
|
The type of the queueing system (e.g., "slurm"). This is
passed to |
'slurm'
|
template
|
str | None
|
An optional submission script template. If provided, it
will be used by |
None
|
config_path
|
Path | str | None
|
An optional path to a directory containing |
None
|
cluster
|
str | None
|
Optional name of the cluster to use. If supported by the installation, this makes it possible to switch between clusters. |
None
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If neither a |
start
async
Start the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_group
|
TaskGroup
|
The task group to use. |
required |