Reuse the baseline across UK local-area breakdown runs

Aperta
#914 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Start by reading src/policyengine_simulation_executor/simulation_runtime.py, especially _uk_area_simulations, and inspect the JobStage.BASELINE spans to measure how much run time the baseline uses. If the cost is significant, compare the proposed cache and warm-worker options and choose an approach keyed by bundle, year, region, and the exact normalized baseline policy. Done means shared eligible runs reuse the baseline while disclosure checks and baseline stage reporting remain intact.

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

Descrizione

Problem

Each UK breakdown=local_areas run builds and computes its own baseline on the routed local-area dataset (_uk_area_simulations in projects/policyengine-simulation-executor/src/policyengine_simulation_executor/simulation_runtime.py). The baseline depends only on the bundle (model and dataset), the year, the region filter (UK-wide or a nation) and the baseline policy. For the usual case (current-law baseline), it is the same for every reform, but every breakdown request pays for it again.

The local-area dataset is the dense file, so the baseline is a large part of each breakdown's run time and cost.

Proposal

Reuse the baseline across breakdown requests that share the same bundle, year, region filter and baseline policy. Options:

  1. Cache the baseline's computed household-level outputs that the area builder reads (for example in the worker volume or object storage), keyed by bundle sha, year, region and a hash of the normalised baseline policy.
  2. Keep a warm baseline in the worker between jobs for the same key.

Things to keep: the disclosure checks, the stage reporting (JobStage.BASELINE), and an exact match on the baseline policy, so a custom baseline never reuses a current-law result.

Next step

Measure first: the share of a breakdown's run time that the baseline takes, from the stage spans. If it is large, choose option 1 or 2. Related: PolicyEngine/policyengine-app-v2#1411 (the app's duration estimate for a breakdown).

🤖 Generated with Claude Code

Lingua principale
Python
Stelle
1
Fork
1
Merge medio
1g 12h
PR unite (30g)
71

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.