Skip to content

Create economy simulations and reports through POST /simulations and POST /reports #1049

Closed

Description

@anth-volk

The detailed-save API's economy path needs the Simulation Entrypoint to create economy simulations and reports in the Public API's run tables and start their calculation on the v2 coordinator and workers, which write the results.

Needed:

  • POST /reports (economy kind) creates the report, its two simulations and their first runs, and its first report run, then starts the report run's coordinator with the report and its run IDs, with no Stage 12 evaluation record. A side whose simulation already succeeded on the same versions reuses that run, as long as its output file is in the output bucket.
  • POST /simulations creates a standalone economy simulation and its first run, and starts that run's simulation function by its run ID.
  • Each request checks every row it names before writing, so a refusal names what's missing; a foreign-key violation on insert is answered as the caller's error. The service records a Modal call's ID once Modal accepts it, or fails the run at once when Modal refuses it, only while the run is still pending with no call ID.
  • The answers match the Public API's client: 201 with the record's and its first run's IDs; 400 with unknown_region, unknown_dataset or unknown_dynamic for the caller's rows, or another code for the service's state; 422 for data that can't be calculated; 503 naming the created record when its run failed; 500 internal_error.
  • GET /reports/{report_id} and GET /simulations/{simulation_id} return each record's newest run.
  • Every staging deploy creates a small economy report and requires its run to succeed; a failure stops the production deploy.

This replaces the draft #974, which was built on tables that no longer exist.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions