perago.WorkerChildSpec#
- class perago.WorkerChildSpec(slot, env)[源代码]#
Supervisor launch specification for one worker child slot.
WorkerChildSpeccarries the per-child environment derived by the supervisor before a multiprocessing child is started. The slot number is stable across restarts, so a restarted child keeps the same worker id.- Parameters:
- slotint
One-based supervisor slot assigned to the worker child.
- envdict of str to str
Environment mapping passed to the child process. It includes
PERAGO_WORKER_ID_PREFIXandPERAGO_WORKER_ID.
- Attributes:
- slotint
One-based supervisor slot assigned to the worker child.
- envdict of str to str
Environment mapping passed to the child process.
worker_idstrReturn the worker id assigned to this child slot.
- 参数:
参见
worker_child_specsBuild child specifications for
perago start -j.restart_backoff_secondsDelay used when a child exits and is restarted.
Notes
The dataclass is frozen, but the
envmapping itself is a regular dictionary supplied by the caller.Examples
>>> spec = WorkerChildSpec(slot=1, env={"PERAGO_WORKER_ID": "features0001"}) >>> spec.worker_id 'features0001'
Methods
__init__(slot, env)Attributes
worker_idReturn the worker id assigned to this child slot.
slotenv