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

Aberta
#1,133 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@anth-volk já está trabalhando nisso.

Desde 26/11/2026.

  • #1134 de @anth-volk — aberto

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
25/100
Tipo de issue
Funcionalidade
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
python
Domínio
backend

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Python
Estrelas
1
Forks
1
Merge médio
1d 14h
PRs com merge (30d)
60

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de PolicyEngine/policyengine-sim-api

Todas as issues de PolicyEngine/policyengine-sim-api

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.