Skip to content

Mode A pre-build sweep runner#135

Merged
arght merged 1 commit into
masterfrom
feat/sweep-runner-mode-a
Jun 23, 2026
Merged

Mode A pre-build sweep runner#135
arght merged 1 commit into
masterfrom
feat/sweep-runner-mode-a

Conversation

@erikfilias

Copy link
Copy Markdown
Contributor

Implements Mode A of the parallelisation plan in the architecture:
a small, additive sweep runner over the existing openTEPES_run.

What it adds

  • openTEPES_Runner.pyrun(cases, solver_name, backend=...) runs many cases through openTEPES_run, one independent build-and-solve per case, over a serial (default, no extra dependency), multiprocessing, or joblib backend.
  • openTEPES_Cases.pyCase names one input source (CSV directory or .duckdb) plus an optional output directory and label.

Design notes

  • openTEPES_run returns the Pyomo model, which cannot cross a worker process boundary, so the runner reads back each case's openTEPES_run_status_*.json and returns one summary dict per case, in input order, for every backend.
  • A case that raises is captured as status="error" so one bad pathway does not abort the rest of the sweep.
  • Additive only: no existing module changes. A single-case serial sweep reproduces a direct openTEPES_run call.

Tests

New tests in tests/test_run.py: serial parity vs a direct run, a multi-case sweep (order, output isolation, captured error), the multiprocessing backend, and the mode/overlay/backend guards.

…_Cases)

  run(cases, solver_name, mode='pre-build', backend=...) drives many cases
  through openTEPES_run, one independent build-and-solve per case, over serial,
  multiprocessing, or joblib backends. A Case points at one input source (CSV
  dir or .duckdb) plus an optional output dir and label. The runner reads back
  each case's openTEPES_run_status_*.json and returns one summary dict per case
  in input order, so nothing has to pickle the Pyomo model across workers; a
  failing case is captured as status='error' instead of aborting the sweep.
  Additive only. New tests cover serial parity, multi-case order/isolation and a
  captured error, the multiprocessing backend, and the mode/overlay/backend
  guards.
@erikfilias erikfilias force-pushed the feat/sweep-runner-mode-a branch from 855b317 to 9a9a9ad Compare June 18, 2026 08:22
@erikfilias erikfilias self-assigned this Jun 18, 2026
@erikfilias erikfilias added the enhancement New feature or request label Jun 18, 2026
@erikfilias erikfilias requested a review from arght June 18, 2026 12:47
@arght arght merged commit 822de34 into master Jun 23, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants