Skip to content

Run economy reports again and list their runs in /v2/reports #4294

Closed

Description

@anth-volk

/v2/reports creates, reads and lists economy reports (#4281), but a report runs only once: there is no way to calculate it again on the current PolicyEngine.py version, to force both simulations to be calculated again, or to see the report's earlier runs. A report whose newest run used an older .py version can be shown as out of date (its run's versions are answered beside the current ones), but nothing offers to run it again.

Wanted: in the Public API's /v2/reports, for economy reports:

  • Re-run: POST /v2/reports/{report_id}/runs?country_id=, with {"force": false} by default. It checks the report's country and the policies its simulations name, as a new report is checked (including the 422 missing_parameters refusal of Refuse /v2/reports and /v2/simulations submissions whose policies set missing parameters #4286), then has the simulation service create and start the report's new run on its default worker's versions. Without force, each side reuses a run of its own simulation that succeeded on those versions; with it, both simulations are calculated again. Every earlier run is kept. It answers the report with its new run, and 409, naming the run, while the report has a run pending or running.
  • Run list: GET /v2/reports/{report_id}/runs?country_id=, every run of the report, newest first, each with its country_package_version and policyengine_version, beside the versions the Public API runs now.
  • Errors must never suggest that nothing started when a new run may have started.

Budget windows (#4290) and household reports get re-runs and run lists once their own PRs merge. The simulation service's POST /reports/{report_id}/runs is being added in a separate simulation-service PR.

This replaces the re-run and run-list routes of the closed #4108, which ran over the simulation service's old records.

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