perago.WorkerChildSpec#

class perago.WorkerChildSpec(slot, env)[源代码]#

Supervisor launch specification for one worker child slot.

WorkerChildSpec carries 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_PREFIX and PERAGO_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_idstr

Return the worker id assigned to this child slot.

参数:

参见

worker_child_specs

Build child specifications for perago start -j.

restart_backoff_seconds

Delay used when a child exits and is restarted.

Notes

The dataclass is frozen, but the env mapping itself is a regular dictionary supplied by the caller.

Examples

>>> spec = WorkerChildSpec(slot=1, env={"PERAGO_WORKER_ID": "features0001"})
>>> spec.worker_id
'features0001'
__init__(slot, env)#
参数:
返回类型:

None

Methods

__init__(slot, env)

Attributes

worker_id

Return the worker id assigned to this child slot.

slot

env