Spawns workers (Effect's Worker.WorkerPlatform); make_platform
builds one from a transport's hooks.
Functions#
__init__#
__init__(spawn) -> None| Parameter | Type | Description |
|---|---|---|
spawn | Callable[[int], Effect[Worker[Any, Any], WorkerError, Spawner]] |
def __init__(
self, spawn: Callable[[int], Effect[Worker[Any, Any], WorkerError, Spawner]]
) -> None:
self._spawn = spawnspawn#
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).
| Parameter | Type | Description |
|---|---|---|
worker_id | int |
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)