fix(params): apply -uw_* CLI overrides regardless of platform (#111)#280
Merged
Conversation
uw.Params reads overrides from the PETSc options database, but petsc4py only auto-populates that DB from sys.argv on some platforms (e.g. macOS) and not others (e.g. Gadi). On Gadi, Params(...) therefore silently fell back to its defaults even when the CLI argument was present — a hard-to-debug, environment-dependent failure with no warning. Params.__init__ now calls uw.parse_cmd_line_options() (idempotent) before reading the options DB, so a '-uw_<name> <value>' override is applied consistently. Regression: tests/test_0821_params_cli_override.py. Closes #111. Underworld development team with AI support from Claude Code
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.
Summary
Fixes #111 —
uw.Paramssilently ignored-uw_*command-line overrides on Gadi (fell back to defaults).Root cause
Paramsreads overrides from the PETSc options database, but petsc4py only auto-populates that DB fromsys.argvon some platforms (macOS) and not others (Gadi). SoParams(...)saw an empty DB and used its defaults — no warning, environment-dependent, hard to debug.Fix
Params.__init__now callsuw.parse_cmd_line_options()(idempotent) before reading the options DB, so the override is applied consistently regardless of platform. The reporter's suggested fix, made automatic.Verification
-uw_cellsize 1/16(DB not pre-populated, mimicking Gadi) → now returns1/16(was1/8).tests/test_0821_params_cli_override.py(2 tests, level_1/tier_a).Closes #111.
Underworld development team with AI support from Claude Code