Skip to content

Run the backfill simulation on Modal; the workflow becomes trigger/commit only - #112

Open
DTrim99 wants to merge 1 commit into
PolicyEngine:mainfrom
DTrim99:modal-backed-backfill
Open

Run the backfill simulation on Modal; the workflow becomes trigger/commit only#112
DTrim99 wants to merge 1 commit into
PolicyEngine:mainfrom
DTrim99:modal-backed-backfill

Conversation

@DTrim99

@DTrim99 DTrim99 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Fixes the reform-validation backfill for good. #107's chunking was necessary but not sufficient: every scheduled run through 7/27 still dies — the logs show even a single 16-spec levels chunk receiving the runner shutdown signal ~5.5 minutes in, before its first simulation completes. One Microsimulation plus the populace/torch import stack no longer fits ubuntu-latest's 7GB, so no chunk size saves the hosted runner.

Design

The simulation moves to Modal; GitHub Actions keeps the schedule, the override-exists guard, and the commit/auto-merge PR role. Every tick now finishes in seconds:

  • tick N — release lacks an override, Volume has no artifact → modal deploy + spawn the run (fire-and-forget, pinned to populace main's current sha for provenance) and exit. A started marker in the Modal workdir prevents double-spawns.
  • tick N+1 — artifact on the Volume → download, gen-reform-overrides.mjs, lint, auto-merging override PR (unchanged from today's flow).

tools/reform_validation/modal_backfill_app.py runs the identical producer pathbackfill.py mounted verbatim into a 64GB container — cloning populace at the requested ref and installing the release-exact policyengine-us/-core from the release manifest at runtime (engine pins vary per release, so they don't belong in the image). The workdir lives on the cd-reform-validation Volume, so batch partials survive any interruption and a re-spawn resumes rather than restarts.

This pattern has now produced three correct artifacts (Build O twice — including the post-populace#513 236-row payload on #109 — with the chunked-levels path exercised end-to-end).

What admins need to do

Add repository secrets MODAL_TOKEN_ID / MODAL_TOKEN_SECRET (PolicyEngine Modal workspace). Until they exist the workflow fails with an explicit error naming them. Compute cost is ~$1–2 per release; ticks with nothing to do never touch Modal compute.

Deployed + pre-seeded

The app is already deployed (cd-reform-validation-backfill) and the Volume is pre-seeded with the Build O artifact — so the first live tick after secrets land will harvest Build O directly if #109 hasn't merged by then (making #109 closable either way).

🤖 Generated with Claude Code

…mmit only

Post-PolicyEngine#107 runs still die on ubuntu-latest: even a single 16-spec levels
chunk gets the runner shutdown signal ~5.5 minutes in, before its first
simulation completes - one Microsimulation plus the populace/torch import
stack no longer fits 7GB, so no chunk size saves the hosted runner.

New tools/reform_validation/modal_backfill_app.py runs the IDENTICAL
producer path (backfill.py mounted verbatim) in a 64GB Modal container:
clones populace at a requested ref, installs the release-exact
policyengine-us/-core from the release manifest at runtime, drives the
batches with a Volume-backed workdir (partials survive interruptions and
resume), and publishes reform_validation_<release_id>.json to the
cd-reform-validation Volume.

The workflow keeps its schedule and override-exists guard but never
simulates: a tick either spawns the Modal run (fire-and-forget, with a
started-marker double-spawn guard) or harvests a finished artifact into
the usual auto-merging override PR. Ticks take seconds; timeout drops
330 -> 30 minutes.

Requires MODAL_TOKEN_ID / MODAL_TOKEN_SECRET repository secrets (fails
with an explicit error until they are set). The Volume is pre-seeded
with the Build O artifact, so the first live tick can harvest it
directly if PolicyEngine#109 has not merged by then.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

@DTrim99 is attempting to deploy a commit to the PolicyEngine Team on Vercel.

A member of the Team first needs to authorize it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant