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

未關閉
#947 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
15/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
gcp, python

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
Python
星號
1
分支
1
平均合併
1 天 12 小時
30 天內合併 PR
71

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

PolicyEngine/policyengine-sim-api 的其他 Issue

查看 PolicyEngine/policyengine-sim-api 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。