Run one warm-up calculation in the simulation workers' snapshot hook

Aperta
#1,133 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@anth-volk ci sta già lavorando.

Dal 26/11/2026.

  • #1134 di @anth-volk — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Start in projects/policyengine-simulation-executor/src/modal/app.py and read the SimulationWorker and SimulationSegmentWorker @modal.enter(snap=True) hooks. Check how the baked region group and first precompute year are selected, then run the existing simulation checks to verify the warm-up produces identical results and a failure only logs a warning. Issue #1134 already has an open linked pull request.

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

Descrizione

The simulation workers (SimulationWorker and SimulationSegmentWorker in projects/policyengine-simulation-executor/src/modal/app.py) load both countries' models in their @modal.enter(snap=True) hook, so containers restored from a memory snapshot start with the models loaded. A restored container's first calculation is still slower than its later ones, because a process's first calculation for a year does one-time work the preload doesn't do.

Measured on Modal testing:

  • 2026-11-25, 8 CPUs: one warm-up calculation of a region group baked into the image, run in the snapshot hook, made restored containers' first calculation 11–15 s faster, with identical results. Containers that took the snapshot started 72–97 s later.
  • 2026-11-26, 1 CPU: the same warm-up made the first calculation 13–16 s faster, and results were identical.

Wanted: the snapshot hook runs one calculation of a baked region group for the first precompute year before Modal takes the snapshot. A failed warm-up only logs a warning and never stops a container from starting. The warm-up opens no network connection, reads no Modal Secret, sends no telemetry, and leaves nothing that changes a later call's result.

Lingua principale
Python
Stelle
1
Fork
1
Merge medio
1g 14h
PR unite (30g)
60

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.