You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The SIR_v5 tests in test_power_edge_without_a_case.py fail on a loaded host: their ∂f/∂p derivation runs past the 20 s wall-clock budget #1416
The three SIR_v5 tests in python/tests/test_power_edge_without_a_case.py need SIR_v5's analytic sensitivity RHS. They derive it under the default BNGSIM_SENS_DERIV_BUDGET_S, a 20 s wall-clock deadline. On a loaded host the derivation can run past it, and then the tests fail on the budget rather than on what they check.
This happened once, in a full BNGSIM_SKIP_AUDIT=strict run under -n 6 on main 49c2931 + #1348, which doesn't touch these files:
FAILED python/tests/test_power_edge_without_a_case.py::test_sir_v5_with_a_singular_exponent_is_refused[dt_2023]
TypeError: argument of type 'NoneType' is not iterable
generate_sens_from_model returned None, as it does when the budget runs out. The test's _source helper is typed -> str and handed that None to not in. On reruns the test passed, alone and under -n 6, on that merge and on main.
Measured on macOS arm64, on a build whose _codegen.py, _jacobian.py and test file are main e5fcfa3's:
The margin. Alone, generate_sens_from_model on SIR_v5 with a_2023 = 1.5 took 3.7 s in one run, so the budget leaves about 5x for load.
The failure, on demand. With BNGSIM_SENS_DERIV_BUDGET_S=0.05:
both cases of test_sir_v5_with_a_singular_exponent_is_refused fail at line 1377 with that TypeError;
test_sir_v5_at_its_own_values_keeps_its_columns fails at line 1406 with SensitivityUnsupportedError ("it has no analytic sensitivity right-hand side (the build-time ∂f/∂p derivation exceeded its 0.05s budget …").
Only this budget matters. With BNGSIM_JAC_DERIV_BUDGET_S=0.05 alone, all three pass.
No silent wrong result. With the budget spent, the sensitivity run is refused, and the decline warning says why: CVODES' difference quotient would be wrong across this model's moving crossings.
This is the failure e8b6e05 fixed for SIR_v4. There, test_sir_v4_keeps_both_derivatives_now_its_model_is_fixed sets both budgets to inf, because what it checks is "whether the derivatives are kept, not how fast they are found".
Proposed fix: the same pin in the three tests, monkeypatch.setenv("BNGSIM_SENS_DERIV_BUDGET_S", "inf") before the first derivation. With it, all three passed locally even under an outer BNGSIM_SENS_DERIV_BUDGET_S=0.05. Optionally, _source could assert that the source isn't None, so a spent budget reads as one instead of as a TypeError.
test_zero_base_power_derivative.py::test_sir_v5_keeps_both_derivatives also derives SIR_v5 under the default budget and asserts has_analytic_sens_rhs. It runs only where the .net corpus is present, so it's exposed in the same way there. I haven't measured it, since it skipped here.
Not checked: other tests in the suite that derive a large model under the default budget.
Activity
tests: derive SIR_v5 unbudgeted where its derivatives are what is ask…
Merge pull request #1422 from Montana/fix/1416-sir-v5-unbudgeted