Skip to content

Implement budget-window batch orchestration in the simulation API #443

@anth-volk

Description

@anth-volk

Follow-up to the contract-first budget-window batch work in #442.

We want to turn the budget-window batch surface into a real backend capability in the simulation API rather than leaving the gateway endpoints disabled.

Scope:

  • add a parent Modal orchestrator in the versioned worker app
  • use the parent Modal function call ID as the batch_job_id
  • fan out yearly child run_simulation jobs with capped parallelism
  • persist parent/child progress in Modal Dict state
  • aggregate annual impacts and totals into the existing budget-window result shape
  • wire the gateway submit/poll endpoints to the real parent job lifecycle
  • add focused tests for orchestration, state progression, aggregation, and gateway polling

Non-goals:

  • API v1 adapter changes
  • Redis caching changes in API v1
  • broader observability work outside what is necessary for this flow

Acceptance criteria:

  • POST /simulate/economy/budget-window returns a real parent batch job id
  • GET /budget-window-jobs/{batch_job_id} returns real running/completed/failed state
  • max_parallel is enforced
  • final output matches the budget-window annual/totals schema expected by API v1
  • the implementation reuses the existing gateway + versioned worker Modal topology rather than introducing a new service boundary

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions