perago.RuntimeConfig#

class perago.RuntimeConfig(*, workspace_root, log_root, log_file_max_size, log_retention, worker_id_prefix, execution_mode='process', workspace_gc_ttl=datetime.timedelta(days=1), workspace_gc_interval=datetime.timedelta(seconds=3600), shutdown_force_kill_after=None, failure_reason_max_length=500, conductor=None, lakefs=None)[源代码]#

Complete worker-local runtime configuration.

RuntimeConfig describes local workspace storage, worker logging, process identity, and optional Conductor and LakeFS connection settings. It is loaded before task module import by the CLI and stays outside the task author contract.

Parameters:
workspace_rootpathlib.Path

Root directory for attempt-local workspaces. Defaults to <tempdir>/perago/workspaces when PERAGO_WORKSPACE_ROOT is not configured.

log_rootpathlib.Path

Root directory for worker JSONL logs. Defaults to <tempdir>/perago/logs when PERAGO_LOG_ROOT is not configured.

log_file_max_sizeint

Log rotation threshold in bytes, parsed from PERAGO_LOG_FILE_MAX_SIZE. The default is 100MB.

log_retentiondatetime.timedelta

Log retention period parsed from PERAGO_LOG_RETENTION. The default is 30d.

worker_id_prefixstr

ASCII alphanumeric prefix used by the supervisor to generate child PERAGO_WORKER_ID values.

execution_mode"process" or "thread"

Worker execution model. Defaults to "process" and may be overridden by PERAGO_EXECUTION_MODE or the perago start CLI.

workspace_gc_ttldatetime.timedelta, default=24h

Minimum age before supervisor periodic GC removes an abandoned attempt-local workspace. Parsed from PERAGO_WORKSPACE_GC_TTL.

workspace_gc_intervaldatetime.timedelta, default=1h

Interval for the supervisor workspace GC loop. Parsed from PERAGO_WORKSPACE_GC_INTERVAL.

shutdown_force_kill_afterdatetime.timedelta or None, default=None

Optional shutdown drain deadline. When configured through PERAGO_SHUTDOWN_FORCE_KILL_AFTER, child processes still alive after the deadline are force-killed.

failure_reason_max_lengthint, default=500

Maximum number of characters written to Conductor reasonForIncompletion for failed attempts. Parsed from PERAGO_FAILURE_REASON_MAX_LENGTH.

conductorConductorConfig or None, default=None

Optional Conductor connection config. perago start requires it.

lakefsLakeFSConfig or None, default=None

Optional LakeFS connection config. perago start requires it.

参数:

参见

load_runtime_config

Build a runtime config from .env and process environment values.

WorkerRuntime

Prepared runtime values for a running worker process.

Notes

The model is frozen and rejects unknown fields. None of these values are embedded in generated Conductor TaskDefs or task payloads.

Examples

>>> from datetime import timedelta
>>> from pathlib import Path
>>> RuntimeConfig(
...     workspace_root=Path("/tmp/perago/workspaces"),
...     log_root=Path("/tmp/perago/logs"),
...     log_file_max_size=104857600,
...     log_retention=timedelta(days=30),
...     worker_id_prefix="appworkersfeaturesbuild",
... )
RuntimeConfig(...)

Attributes

workspace_root

log_root

log_file_max_size

log_retention

worker_id_prefix

execution_mode

workspace_gc_ttl

workspace_gc_interval

shutdown_force_kill_after

failure_reason_max_length

conductor

lakefs