GitHub

WorkerPlatformService

API reference for WorkerPlatformService.

Spawns workers (Effect's Worker.WorkerPlatform); make_platform builds one from a transport's hooks.

Functions

__init__

__init__(spawn) -> None
ParameterTypeDescription
spawnCallable[[int], Effect[Worker[Any, Any], WorkerError, Spawner]]
def __init__(
    self, spawn: Callable[[int], Effect[Worker[Any, Any], WorkerError, Spawner]]
) -> None:
    self._spawn = spawn

spawn

spawn(worker_id) -> Effect[Worker[Any, Any], WorkerError, Spawner]

The worker for worker_id, found with the Spawner in the context; it starts when it is run. Fails with a WorkerError when the platform cannot make it (make_platform's never fails: a worker that cannot start fails its run).

ParameterTypeDescription
worker_idint

Returns Effect[Worker[Any, Any], WorkerError, Spawner]

def spawn(self, worker_id: int) -> Effect[Worker[Any, Any], WorkerError, Spawner]:
    """The worker for ``worker_id``, found with the ``Spawner`` in the
    context; it starts when it is run. Fails with a ``WorkerError``
    when the platform cannot make it (``make_platform``'s never
    fails: a worker that cannot start fails its run)."""
    return self._spawn(worker_id)