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.
RuntimeConfigdescribes 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/workspaceswhenPERAGO_WORKSPACE_ROOTis not configured.- log_rootpathlib.Path
Root directory for worker JSONL logs. Defaults to
<tempdir>/perago/logswhenPERAGO_LOG_ROOTis not configured.- log_file_max_sizeint
Log rotation threshold in bytes, parsed from
PERAGO_LOG_FILE_MAX_SIZE. The default is100MB.- log_retentiondatetime.timedelta
Log retention period parsed from
PERAGO_LOG_RETENTION. The default is30d.- worker_id_prefixstr
ASCII alphanumeric prefix used by the supervisor to generate child
PERAGO_WORKER_IDvalues.- execution_mode"process" or "thread"
Worker execution model. Defaults to
"process"and may be overridden byPERAGO_EXECUTION_MODEor theperago startCLI.- 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
reasonForIncompletionfor failed attempts. Parsed fromPERAGO_FAILURE_REASON_MAX_LENGTH.- conductorConductorConfig or None, default=None
Optional Conductor connection config.
perago startrequires it.- lakefsLakeFSConfig or None, default=None
Optional LakeFS connection config.
perago startrequires it.
- 参数:
workspace_root (Path)
log_root (Path)
log_file_max_size (int)
log_retention (timedelta)
worker_id_prefix (str)
execution_mode (Literal['process', 'thread'])
workspace_gc_ttl (timedelta)
workspace_gc_interval (timedelta)
shutdown_force_kill_after (timedelta | None)
failure_reason_max_length (int)
conductor (ConductorConfig | None)
lakefs (LakeFSConfig | None)
参见
load_runtime_configBuild a runtime config from
.envand process environment values.WorkerRuntimePrepared 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_rootlog_rootlog_file_max_sizelog_retentionworker_id_prefixexecution_modeworkspace_gc_ttlworkspace_gc_intervalshutdown_force_kill_afterfailure_reason_max_lengthconductorlakefs