Reuse the baseline across UK local-area breakdown runs

Aberta
#914 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
35/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
backend, performance

Direção de pesquisa

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.

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

Descrição

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

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

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.