Files
svcforge/services/worker/deps.py
T
Nguyen Minh Phuc 50c2fe2a1e
ci / lint (push) Successful in 1m19s
ci / unit (push) Failing after 1m2s
ci / integration (push) Has been skipped
ci / types (push) Successful in 1m37s
ci / security (push) Failing after 38s
ci / dockerfile (push) Successful in 14s
ci / image (api) (push) Has been skipped
ci / image (reconciler) (push) Has been skipped
ci / image (worker) (push) Has been skipped
ci / bump (push) Has been skipped
svcforge: reference implementation
Complete working build of the system learn-python/ teaches.
164 tests, mypy --strict clean, domain coverage 99%.
2026-07-17 10:44:54 +00:00

34 lines
1.0 KiB
Python

"""What a worker needs to do its job.
One frozen bag of collaborators, constructed once in main() and passed down. Handlers
take `deps` rather than reaching for globals, which is the entire reason the worker tests
run in milliseconds against a FakeProvisioner instead of needing a cluster.
"""
from __future__ import annotations
from dataclasses import dataclass
from svcforge_core.adapters.clock import Clock
from svcforge_core.adapters.helm import Provisioner
from svcforge_core.adapters.notify import Notifier
from svcforge_core.domain.models import CatalogEntry
from svcforge_core.repo.db import DictPool
from svcforge_core.repo.instances import InstanceRepo
from svcforge_core.repo.tasks import TaskRepo
from svcforge_core.settings import Settings
@dataclass(frozen=True)
class WorkerDeps:
"""Everything a handler is allowed to touch."""
pool: DictPool
instances: InstanceRepo
tasks: TaskRepo
provisioner: Provisioner
notifier: Notifier
clock: Clock
catalog: dict[str, CatalogEntry]
settings: Settings