generated from coulomb/repo-seed
feat(worker): scaffold activities, workflows, worker entrypoint — T13
src/activity_core/activities.py:
- load_activity_definition, resolve_context, log_run — @activity.defn
stubs (raise NotImplementedError, bodies in T14–T17)
src/activity_core/workflows.py:
- RunActivityWorkflow (orchestrator-tq) — @workflow.defn stub (T18)
- TaskExecutorWorkflow (task-execution-tq) — @workflow.defn stub (T19)
src/activity_core/worker.py:
- Connects to Temporal via TEMPORAL_HOST / TEMPORAL_NAMESPACE env vars
- Spawns two Workers: orchestrator-tq and task-execution-tq
- Runs until cancelled (python -m activity_core.worker)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
41
src/activity_core/activities.py
Normal file
41
src/activity_core/activities.py
Normal file
@@ -0,0 +1,41 @@
|
||||
"""Temporal activity definitions for activity-core.
|
||||
|
||||
Activities run inside a Worker bound to 'orchestrator-tq'.
|
||||
Each function is decorated with @activity.defn and executed by
|
||||
RunActivityWorkflow via workflow.execute_activity().
|
||||
|
||||
Implementations are added in T14–T17; stubs here let the worker
|
||||
register correctly before the bodies are written.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from temporalio import activity
|
||||
|
||||
|
||||
@activity.defn
|
||||
async def load_activity_definition(activity_id: str) -> dict:
|
||||
"""Load an ActivityDefinition row from the DB by ID.
|
||||
|
||||
Returns a JSON-serialisable dict (Pydantic .model_dump()).
|
||||
Implemented in T14.
|
||||
"""
|
||||
raise NotImplementedError("T14")
|
||||
|
||||
|
||||
@activity.defn
|
||||
async def resolve_context(context_sources: list[dict]) -> dict:
|
||||
"""Fetch and merge all context sources into a single snapshot dict.
|
||||
|
||||
Implemented in T15.
|
||||
"""
|
||||
raise NotImplementedError("T15")
|
||||
|
||||
|
||||
@activity.defn
|
||||
async def log_run(run_payload: dict) -> str:
|
||||
"""Persist an ActivityRun record and return its run_id.
|
||||
|
||||
Implemented in T17.
|
||||
"""
|
||||
raise NotImplementedError("T17")
|
||||
Reference in New Issue
Block a user