perago.worker_child_specs#
- perago.worker_child_specs(*, base_env, module_target, process_count)[源代码]#
Build stable worker child specifications for a supervisor run.
The supervisor uses these specs for
perago start -j. Each child receives a one-based slot and a deterministicPERAGO_WORKER_IDderived from the configured prefix or, when no prefix is configured, frommodule_target.- Parameters:
- base_envdict of str to str
Base environment copied into every child.
PERAGO_WORKER_ID_PREFIXis honored when present.- module_targetstr
Python import path of the single task module served by all child workers.
- process_countint
Number of worker child specs to create. Must be at least one.
- Returns:
- list of WorkerChildSpec
Child launch specs ordered by ascending slot.
- Raises:
- RuntimeConfigError
If
process_countis less than one or if the worker id prefix is invalid.
- 参数:
- 返回类型:
参见
WorkerChildSpecValue object returned for each child slot.
restart_backoff_secondsRestart delay used after a child exits.
Examples
>>> [spec.worker_id for spec in worker_child_specs( ... base_env={"PERAGO_WORKER_ID_PREFIX": "featuresBuild"}, ... module_target="app.workers.features_build", ... process_count=2, ... )] ['featuresBuild0001', 'featuresBuild0002']