Add the --allow-blocking-problems option to rubem run - #355
Merged
Merged
Conversation
By default every check of the input validation runs, the problems are logged as warnings and a blocking one raises ConfigurationError, so the run stops with exit code 1; with -s the content checks do not run at all. Neither lets a user run past a blocking problem and still see it. ModelConfiguration takes allow_blocking_problems=False. With it the same checks run, every problem stays in ModelConfiguration.problems, the blocking ones are logged at ERR, a final ERR line states that the simulation continues despite N blocking problem(s), and the configuration loads instead of raising. ModelConfiguration.load passes it through. rubem run --allow-blocking-problems (no short form) hands the keyword through. It cannot be combined with -s, which skips the very checks the option exists to report: that is a usage error with exit code 2, raised before anything else runs. Failures that are not problems (schema validation, missing lookup table files, no raster format enabled, the DEM/clone/georeference mismatch) stay fatal, and a forced run that fails exits 1. The deprecated rubem -c <config> spelling does not take the option. Tests: the loader keeps and reports the problems at both levels, the command line stops by default, runs with the option, refuses the combination with -s, refuses the option on the legacy spelling, and a forced run over a rainy days table without December (never read by the January and February run) reproduces the goldens.
Model.from_file and Model.from_config take the keyword and hand it to ModelConfiguration on the same path as validate_input; Model keeps it next to the validation flag so that an isolated run rebuilds the configuration in the subprocess with the same leniency instead of raising ConfigurationError there. A configuration loaded elsewhere is not checked again: for it the keyword only rules the rebuild. The public signatures pinned by the tests gain the keyword; the child entry points of the isolated-run tests take the extra argument.
The user guide shows the option in the rubem run -h block, contrasts it with -s (checks skipped, nothing reported) and states the exit codes, the usage error of the combination, the failures that stay fatal and what a forced run prints. The Python API page describes the keyword of the loaders and that an isolated run carries it across the process boundary.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #355 +/- ##
==========================================
+ Coverage 92.86% 92.87% +0.01%
==========================================
Files 64 64
Lines 4357 4365 +8
Branches 556 558 +2
==========================================
+ Hits 4046 4054 +8
Misses 248 248
Partials 63 63 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
camilabillerbeck
approved these changes
Sep 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
Description
ModelConfiguration(..., allow_blocking_problems=False), also onModelConfiguration.load: the same checks run and every problem stays inModelConfiguration.problems. With the keyword the blocking problems are logged atERR(the non-blocking ones stay atWRN), one finalERRline states that the simulation continues despite N blocking problem(s), and the configuration loads instead of raisingConfigurationError. Without it nothing changes: every problem is logged atWRNand the blocking ones raise, the zero-denominator domains (Tw >= 1,C_wp >= 1) included.rubem run --allow-blocking-problems(no short form) passes the keyword through. Combined with-s/--skip-inputs-validationit is a usage error (exit code 2, raised before anything else runs), since-sskips the very checks the option reports. Failures that are notProblems stay fatal: schema validation, a missing lookup table file, no raster format enabled, the DEM/clone/georeference mismatch. Exit code 0 when the forced run completes, 1 when it fails. The option is not added to_LEGACY_OPTIONS, sorubem -c <config> --allow-blocking-problemsis rejected with exit code 2.validate_input.Model.from_file(..., allow_blocking_problems=False)andModel.from_config(..., allow_blocking_problems=False)hand it to the loader;Modelkeeps it next to the validation flag andModel.run_isolatedpasses both to the subprocess, so the rebuild there does not raise. For an already loaded configuration the keyword only rules the rebuild, likevalidate_input. The documented signatures pinned bytests/unit/apigain the keyword; the child entry points of those tests take the extra argument.tests/unit/configuration/test_validation_tiers.py): the blocking problems are kept and logged atERROR, the non-blocking ones atWARNING, the closing line, the default still raises, nothing is reported without blocking problems,loadpasses the keyword through. Command line (tests/unit/test_cli_run.py): a rainy days table without December (a blocking problem the January and February run never reads) exits 1 by default and runs with the option with theERRlines on stderr; the option is silent without blocking problems; a forced run over a missing precipitation step starts and exits 1; a document that does not parse still exits 1;-sand--skip-inputs-validationwith the option exit 2; the legacy spelling exits 2; the help lists the option. Subprocess (tests/integration/test_cli.py): the usage error, and a forced run over the same broken table that reproduces the goldens. API (tests/unit/api/test_model.py): both loaders, an in-process run, the isolated run with the keyword and with an already loaded configuration.rubem run -hblock and a paragraph contrasting-swith the new option (exit codes, the usage error, what stays fatal, the output of a forced run) in the user guide; the keyword of the loaders and the subprocess rebuild on the Python API page; changelog entry under Added.Related Issue
Motivation and context
rubem runlet a user run past a blocking problem and still see it: the default stops with exit code 1, and-sruns blind, since the content checks do not run at all (the lookup table checks, the runoff coefficient domain, the series resolver checks and the grid cell size check among them). Exploring a dataset, or reproducing a published run whose inputs fail a check, needs a third mode that keeps the checks and their report but not the stop.How has this been tested
python -m pytest -n auto -ra -p no:cacheprovider --ignore=tests/integration/doc: 1329 passed, 1 skipped (the byte-exact golden test, CI-only), on this branch (Linux, Python 3.13.7, PCRaster 4.4.2, GDAL 3.11.5).uvx ruff@0.16.4 format --check .anduvx ruff@0.16.4 check .: clean.codespell2.4.3 on the changed files: clean.sphinx-build -W -b htmlon Python 3.13 from a clean export of the branch: no warnings.--allow-blocking-problemsthe run exits 0, the problem is logged atERRwith the "Simulation continues despite 1 blocking problem(s)." line, and its 36 output files are byte-identical to the baseline's;-s --allow-blocking-problemsexits 2; the legacy spelling with the option exits 2. The dataset files were not modified (the manifests and the table copy live in a scratch directory).Left as written, for the reviewer:
metadata.json(format 1.0 only), is not implemented here: it changes the metadata document and deserves its own decision.Problemcarries no such attribute. A forced run over a structural problem starts and fails inside the run with exit code 1, which the user guide states and a test pins.rubem calibrate) is still open: when it rebases it finds the keyword on the loaders; whether its single validated load should take it is a decision for that PR.kc_max < kc_min, area fractions of class 0), untouched here.Screenshots