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_config reads a simple .env file from cwd and then overlays process environment variables. It parses Perago local directory settings, worker identity settings, and optional Conductor and LakeFS connection settings into a frozen RuntimeConfig.

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_PREFIX is not configured.

cwdpathlib.Path or None, default=None

Directory used to locate .env. None uses the current working directory.

process_envdict of str to str or None, default=None

Environment mapping that overrides .env values. None reads os.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.

参数:
返回类型:

RuntimeConfig

参见

RuntimeConfig

Parsed configuration returned by this loader.

prepare_worker_runtime

Prepare runtime identity and logging for a worker process.

Notes

perago check and perago extract use this loader but do not require Conductor or LakeFS config to be present. perago start performs 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(...)