Migrate hydro harness invocations to generic_cylinders.py#659
Merged
DLWoodruff merged 3 commits intoPyomo:mainfrom Apr 21, 2026
Merged
Migrate hydro harness invocations to generic_cylinders.py#659DLWoodruff merged 3 commits intoPyomo:mainfrom
DLWoodruff merged 3 commits intoPyomo:mainfrom
Conversation
hydro.py already exposes scenario_creator, scenario_names_creator, kw_creator, inparser_adder, and scenario_denouement. The custom drivers were just thin wrappers, and generic_tester.py has been exercising hydro through generic_cylinders.py for a while. - Archive examples/hydro/hydro_cylinders_pysp.py and hydro_ef.py under examples/hydro/archive/ rather than deleting them. The PySP version is the older pattern and new code should not follow it; hydro_ef.py has no callers anywhere. - run_all.py: keep the rst-documented hydro_cylinders.py invocation, add a parallel generic_cylinders.py invocation, drop the PySP one. - afew.py: replace the PySP invocation with generic_cylinders.py. - doc/src/pysp.rst and doc/src/examples.rst: point readers at generic_cylinders.py for new work; mention the archived PySP driver only as a back-reference. hydro_cylinders.py itself is retained (referenced from drivers.rst, examples.rst, and spokes.rst as the canonical multistage cylinder example). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #659 +/- ##
==========================================
- Coverage 70.74% 70.73% -0.02%
==========================================
Files 153 153
Lines 19011 19011
==========================================
- Hits 13449 13447 -2
- Misses 5562 5564 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The original hydro_cylinders_pysp.py entry did not need
--stage2EFsolvern because it bypassed generic_cylinders.py entirely.
After migrating to generic_cylinders.py, the assert in
mpisppy/generic/parsing.py fires:
"For now, stage2EFsolvern is required for multistage xhat"
Add --stage2EFsolvern={solver_name}, matching the parallel run_all.py
entry.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bknueven
approved these changes
Apr 19, 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.
Summary
examples/hydro/hydro_cylinders_pysp.py(older PySP-based driver) andexamples/hydro/hydro_ef.py(no callers) underexamples/hydro/archive/.examples/run_all.pyandexamples/afew.pyto usempisppy/generic_cylinders.py --module-name hydro.hydro.pyalready exposes the hooks the generic driver needs, andgeneric_tester.pyhas been exercising it that way.examples/hydro/hydro_cylinders.py. It is referenced fromdoc/src/drivers.rst,doc/src/examples.rst, anddoc/src/spokes.rstas the canonical multistage custom-cylinder example;run_all.pystill runs it alongside the new generic-driver invocation.doc/src/pysp.rstanddoc/src/examples.rstto point new users at the generic driver; the archived PySP driver is mentioned only as a back-reference.Test plan
mpiexec -np 3 python -m mpi4py ../../mpisppy/generic_cylinders.py --module-name hydro --branching-factors '3 3' --max-iterations=10 --default-rho=1 --xhatshuffle --lagrangian --stage2EFsolvern=gurobi_persistent --solver-name=gurobi_persistent— runs, PH + lagrangian + xhatshuffle converge as expectedmpiexec -np 3 python -m mpi4py hydro_cylinders.py …still works (sanity that the retained driver wasn't disturbed)ruff checkonexamples/run_all.pyandexamples/afew.py🤖 Generated with Claude Code