Skip to content

Migrate hydro harness invocations to generic_cylinders.py#659

Merged
DLWoodruff merged 3 commits intoPyomo:mainfrom
DLWoodruff:hydro_update
Apr 21, 2026
Merged

Migrate hydro harness invocations to generic_cylinders.py#659
DLWoodruff merged 3 commits intoPyomo:mainfrom
DLWoodruff:hydro_update

Conversation

@DLWoodruff
Copy link
Copy Markdown
Collaborator

@DLWoodruff DLWoodruff commented Apr 19, 2026

Summary

  • Archive examples/hydro/hydro_cylinders_pysp.py (older PySP-based driver) and examples/hydro/hydro_ef.py (no callers) under examples/hydro/archive/.
  • Switch the hydro invocations in examples/run_all.py and examples/afew.py to use mpisppy/generic_cylinders.py --module-name hydro. hydro.py already exposes the hooks the generic driver needs, and generic_tester.py has been exercising it that way.
  • Keep examples/hydro/hydro_cylinders.py. It is referenced from doc/src/drivers.rst, doc/src/examples.rst, and doc/src/spokes.rst as the canonical multistage custom-cylinder example; run_all.py still runs it alongside the new generic-driver invocation.
  • Update doc/src/pysp.rst and doc/src/examples.rst to 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 expected
  • mpiexec -np 3 python -m mpi4py hydro_cylinders.py … still works (sanity that the retained driver wasn't disturbed)
  • ruff check on examples/run_all.py and examples/afew.py
  • CI run_all / generic_tester jobs on this PR

🤖 Generated with Claude Code

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
Copy link
Copy Markdown

codecov Bot commented Apr 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.73%. Comparing base (d3ef3ba) to head (85ff195).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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>
@DLWoodruff DLWoodruff enabled auto-merge (squash) April 21, 2026 17:45
@DLWoodruff DLWoodruff merged commit 4bd0393 into Pyomo:main Apr 21, 2026
28 checks passed
@DLWoodruff DLWoodruff deleted the hydro_update branch April 21, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants