perago.load_runtime_config#
- perago.load_runtime_config(module_target, *, cwd=None, process_env=None, probe_roots=True)[源代码]#
Load worker-local runtime configuration.
load_runtime_configreads a simple.envfile fromcwdand then overlays process environment variables. It parses Perago local directory settings, worker identity settings, and optional Conductor and LakeFS connection settings into a frozenRuntimeConfig.- Parameters:
- module_targetstr
Python module import path for the single task module. It is used to derive the default worker id prefix when
PERAGO_WORKER_ID_PREFIXis not configured.- cwdpathlib.Path or None, default=None
Directory used to locate
.env.Noneuses the current working directory.- process_envdict of str to str or None, default=None
Environment mapping that overrides
.envvalues.Nonereadsos.environ; an empty dictionary intentionally prevents reading the real process environment.- probe_rootsbool, default=True
Whether to create and remove temporary probe files under the resolved workspace and log roots to verify that both directories are writable.
- Returns:
- RuntimeConfig
Parsed runtime configuration for CLI commands and worker processes.
- Raises:
- RuntimeConfigError
If a configured value is malformed, a required LakeFS variable is missing from a partial LakeFS configuration, a connection placeholder is still set to
"replace-me", or a probed root directory is not writable.
- 参数:
- 返回类型:
参见
RuntimeConfigParsed configuration returned by this loader.
prepare_worker_runtimePrepare runtime identity and logging for a worker process.
Notes
perago checkandperago extractuse this loader but do not require Conductor or LakeFS config to be present.perago startperforms additional checks after loading and requires both external service configs.Examples
>>> load_runtime_config( ... "app.workers.features_build", ... process_env={"PERAGO_WORKER_ID_PREFIX": "featuresBuild"}, ... probe_roots=False, ... ) RuntimeConfig(...)