Skip to content

Mode A pre-build sweep runner#135

Open
erikfilias wants to merge 1 commit into
masterfrom
feat/sweep-runner-mode-a
Open

Mode A pre-build sweep runner#135
erikfilias wants to merge 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.
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.

1 participant