accelmo.fitting.lifecycle

The run/interrupt/cleanup shape every fitter shares.

accelmo.fitting.lifecycle.run_with_workers(body, *, fallback, stop_workers, run_log=None)[source]

Run body; on Ctrl-C return fallback() (the best result so far) instead.

The workers are stopped and the run log closed however the run ends; any other exception propagates once they are.

Return type:

T

Parameters:
  • body (Callable[[], T])

  • fallback (Callable[[], T])

  • stop_workers (Callable[[], None])

  • run_log (RunLog | None)