Servers
ropt.plugins.server.base.ServerPlugin
Bases: Plugin
Abstract base class for asynchronous server plugins.
This class defines the interface for plugins responsible for creating
Evaluator instances within
an optimization workflow.
create
abstractmethod
classmethod
Create a Server instance.
This abstract class method serves as a factory for creating concrete
Server objects. Plugin
implementations must override this method to return an instance of their
specific Server subclass.
The PluginManager calls this method when
an evaluator provided by this plugin is requested.
The name argument specifies the requested evaluator, potentially
in the format "plugin-name/method-name" or just "method-name".
Implementations can use this name to vary the created evaluator if
the plugin supports multiple evaluator types.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The requested server name (potentially plugin-specific). |
required |
kwargs
|
Any
|
Additional arguments for custom configuration. |
{}
|
Returns:
| Type | Description |
|---|---|
Server
|
An initialized instance of an |
ropt.plugins.server.base.Server
Bases: ABC
Abstract base class for server components within an optimization workflow.
Subclasses must implement the following abstract methods and properties:
start: Starts the server.cancel: Stops the server.task_queue: Retrieves the servers task queue.loop: Retrieves the currently running asyncio loop.task_group: The asyncio.Taskgroup used by this server.is_running: Checks if the server is running.
loop
abstractmethod
property
Get the asyncio loop used by this server.
task_group
abstractmethod
property
Get the task group used by this server.
start
abstractmethod
async
Start the evaluation server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_group
|
TaskGroup
|
The task group to use. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the evaluator is already running or using an external queue. |
is_running
abstractmethod
Check if the server is not running.
Returns:
| Type | Description |
|---|---|
bool
|
True if the server is not running. |
ropt.plugins.server.base.Task
dataclass
Bases: ABC
A task to be executed by a worker.
Attributes:
| Name | Type | Description |
|---|---|---|
function |
Callable[..., Any]
|
The function to execute. |
args |
tuple[Any, ...]
|
The arguments to pass to the function. |
kwargs |
dict[str, Any]
|
The keyword arguments to pass to the function. |
results_queue |
ResultsQueue
|
The queue to put the result in. |
result |
Any | None
|
The result of the function, or None if no result is available. |