Run one warm-up calculation in the simulation workers' snapshot hook
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 1
- Forks
- 1
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 60
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PolicyEngine/policyengine-sim-api
-
Rename Populace to Microcosm in docstrings and test namesPossibly taken @MaxGhenis claimed this 10 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
PolicyEngine/policyengine-sim-api#1086 ·
Maintainers usually reply within 1 day
-
Update policyengine to 6.20.2Possibly taken @policyengine claimed this 10 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 63/100
PolicyEngine/policyengine-sim-api#1083 ·
Maintainers usually reply within 1 day
-
Update policyengine to 6.7.3May be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 Half a day Newbie friendliness 70/100
PolicyEngine/policyengine-sim-api#823 ·
Maintainers usually reply within 1 day
-
Integration tests fail due to missing UV virtual environment setupPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
PolicyEngine/policyengine-sim-api#314 ·
Maintainers usually reply within 1 day
-
Read dynamics from API v1's dynamic_parameters and dynamic_parameter_values tablesPossibly taken @anth-volk claimed this 1 day ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 52/100
PolicyEngine/policyengine-sim-api#1128 ·
Maintainers usually reply within 1 day
All issues in PolicyEngine/policyengine-sim-api
Similar issues
-
claude-subscription-directsdk: tool calls with raw control characters in string values are droppedOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NousResearch/hermes-official-plugins#538 ·
Maintainers usually reply within 3 days
-
bug(qdiffusion): EnergyModel.score_visible_logits computes biased visible/hidden on-ratios when solver returns variable solution counts per candidatePossibly taken @houzhongyu claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
qboson/kaiwu-pytorch-plugin#2133 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
MakazhanAlpamys/Soup#3415 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days