set_input for one period leaves the variable's cached sum or twelfth over an overlapping period in place
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 68/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- backend, performance
Línea de trabajo
Start by tracing Holder.set_input and Holder._set, then follow Simulation.calculate_add, calculate_divide, and _calculate to understand how overlapping periods and branches are cached. Reproduce the four calculation sequences in the issue; done means setting an input for its own period no longer leaves stale sums or twelfths while existing cache behavior remains intact.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
set_input for one of a variable's own periods (one month of a monthly variable, one year of a yearly one) replaces the value stored for that period, but leaves in place what the simulation had calculated from it for the same variable at periods of another size: the sum calculate caches for a monthly flow over a year, and the twelfth it caches for a yearly flow at a month. A later calculate returns the cached value, so the result depends on whether the longer (or shorter) period was read before the input was set.
Executed on master b78b0ba9 (two people, formula-less float variables, auto_carry_over_input_variables off):
| Steps | Result |
|---|---|
calculate("flow_m", "2013"); set_input("flow_m", "2013-05", [50, 0]); calculate("flow_m", "2013") |
[0, 0] |
set_input("flow_m", "2013-05", [50, 0]); calculate("flow_m", "2013") |
[50, 0] |
calculate("flow_y", "2013-05"); set_input("flow_y", "2013", [1200, 0]); calculate("flow_y", "2013-05") |
[0, 0] |
set_input("flow_y", "2013", [1200, 0]); calculate("flow_y", "2013-05") |
[100, 0] |
flow_m is a monthly float variable and flow_y a yearly one, both with no formula.
Where it comes from: Simulation.calculate_add stores the sum at the requested period and calculate_divide stores the twelfth at the month (holder.put_in_cache(result, period, self.branch_name)), and _calculate returns a stored value for the requested period before anything else. Holder.set_input with a period of the variable's own unit calls Holder._set for that period only.
The inputs set over a longer period through set_input_divide_by_period and set_input_dispatch_by_period have the same problem and more; the PR for those helpers drops the variable's calculated sums and twelfths that overlap the input period. This issue is the remaining path: an input for the variable's own period. The same rule would fix it (an input drops the values calculated for that variable at overlapping periods of another size, on the branch it is stored under and the branches read through it), applied in Holder.set_input.
Not covered by #571 (which keeps the cache for a flow read over a period of another unit), #566/#576 (the fast cache, not holder storage) or #560 (other variables calculated from the input, on branches).
- Lenguaje dominante
- Python
- Estrellas
- 22
- Forks
- 30
- Merge medio
- 2 d 21 h
- PR fusionados (30 d)
- 24
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PolicyEngine/policyengine-core
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
PolicyEngine/policyengine-core#605 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
PolicyEngine/policyengine-core#549 ·
Los mantenedores suelen responder en 2 días
-
`restore_simulation` silently drops memberless group entitiesPosiblemente ocupada @Adelagric la tomó hace 32 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
PolicyEngine/policyengine-core#547 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
PolicyEngine/policyengine-core#609 ·
Los mantenedores suelen responder en 2 días
-
Every new system compiles its variable files again, which sys.monitoring coverage retainsPosiblemente ocupada @MaxGhenis la tomó hace 1 día. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
PolicyEngine/policyengine-core#607 ·
Los mantenedores suelen responder en 2 días
Todos los issues de PolicyEngine/policyengine-core
Issues similares
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
openwisp/openwisp-utils#777 ·
-
Boolean statistics (Covered, Confident, JaccardDistant) aggregate to 1.0 without float weightsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 63/100
google-research/weatherbenchX#310 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
huggingface/peft#3955 ·
Los mantenedores suelen responder en 1 día
-
author-page correction
Dificultad 2/5 1-3 horas Aptitud para principiantes 60/100
acl-org/acl-anthology#10313 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
AOSSIE-Org/Gitcord-GithubDiscordBot#147 · 1 comentario ·
Los mantenedores suelen responder en 1 día