Files
gitea a16050c80a
CI / lint-and-build (push) Has been cancelled
CI / python-checks (3.12) (push) Has been cancelled
feat: multiple updates - alerts, auth, sectors, rotation service, financials ingestion, task specs, and agent framework
2026-06-06 22:01:40 -04:00

1.9 KiB

Task: Pipeline task definitions

Goal

Create the task definition classes and registry for the pipeline orchestrator. This is Phase 1 — define what tasks exist and their metadata.

Requirements

Create src/backend/services/pipeline_tasks.py

Implement:

  1. PipelineTask dataclass:

    • name: str — unique task identifier
    • description: str — human-readable name
    • func: Callable — async function to execute
    • depends_on: list[str] — task names that must complete first
    • timeout: int — max execution time in seconds
    • retry_count: int — number of retries on failure
  2. TaskRegistry class:

    • register(task: PipelineTask) — add task to registry
    • get(task_name: str) -> PipelineTask — lookup task
    • get_all() -> list[PipelineTask] — list all registered tasks
    • get_dependencies(task_name: str) -> list[str] — get task dependencies
    • get_ready_tasks( completed: set[str]) -> list[str] — find tasks whose deps are met
  3. Register built-in tasks:

    • news_ingestion — runs news data ingestion
    • financials_ingestion — runs financials data ingestion
    • sector_rotation — runs sector rotation analysis
    • price_update — runs price data update
    • sentiment_analysis — runs sentiment analysis

Constraints

  • File under 200 lines
  • Use existing async patterns
  • No real DB calls in task definitions

Acceptance Criteria

  1. TaskRegistry correctly tracks tasks and dependencies
  2. get_ready_tasks() returns correct task order
  3. All 5 built-in tasks are registered
  4. File is under 200 lines

Files to Create

  • src/backend/services/pipeline_tasks.py

Files to Read First

  • src/backend/services/news_ingestion_service.py — existing task functions
  • src/backend/services/financials_ingestion_service.py — existing task functions
  • src/backend/services/rotation_service.py — existing task functions