Record simulation runs and report runs, and their outcomes when Modal reports that a call ended

Aperta
#947 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
15/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
gcp, python

Direzione di ricerca

Start at the Simulation Entrypoint and the existing schema/migrations that define simulation.simulation_runs and simulation.report_runs. Trace how v2 Modal calls are dispatched and where sim's main URL receives callbacks, then map the conditional status transitions and the Cloud Run safety job. Done means runs move only through expected-status updates, Modal callbacks are verified and idempotent, abandoned dispatching runs are failed by the sweeper, and deploys pass sim's Modal token to the entrypoint.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Each simulation can run many times (on newer model or data versions, or when a user runs a report again), and a report run should reuse a simulation run that already exists, most often the current-law baseline. The Simulation Entrypoint needs to record those executions and learn their outcomes without any caller polling:

  • simulation.simulation_runs: one execution of a simulation for a catalog version and year, with the region and dataset rows it resolved in that version, its status (pending, dispatching, running, succeeded, failed), Modal call ID, timings, error, trigger and attempt number; unique per simulation, catalog version, year and attempt.
  • simulation.report_runs: one calculation of a report, joining a baseline and a reform simulation run of the same catalog version and year, with the economy comparison step's own status and Modal call.
  • Every status change is one conditional update on the expected status, so a second writer changes nothing; only the caller that moves runs from pending to dispatching starts their Modal call; a household report's two runs share one call and change together.
  • When a v2 Modal call ends, it reports that to sim's main URL with the call ID and run IDs (no result). sim checks that the request comes from sim's own Modal function, asks Modal for the call's outcome itself, and records it. A repeated report changes nothing.
  • A safety check, a Cloud Run job that Cloud Scheduler starts every few minutes, records calls whose report never arrived and fails runs left dispatching. It runs only the promoted revision's image.
  • The web service keeps no CPU or instance for recording, so a rejected or rolled-back revision never records anything. Every deploy gives the entrypoint sim's own Modal token.

No route creates runs yet; the stage 2 routes do, and the v2 Modal functions call the sender then.

Lingua principale
Python
Stelle
1
Fork
1
Merge medio
1g 12h
PR unite (30g)
71

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PolicyEngine/policyengine-sim-api

Tutte le issue di PolicyEngine/policyengine-sim-api

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.