Add solver settings display and configuration options to rota detail view

This commit is contained in:
Ross
2025-12-17 17:58:32 +00:00
parent 023e345591
commit dadf035627
4 changed files with 140 additions and 2 deletions
+15 -2
View File
@@ -90,8 +90,21 @@ def _run_rota_job(run_id: int, use_external_generator: bool = False, generate_bu
err_buf = io.StringIO()
with contextlib.redirect_stdout(out_buf), contextlib.redirect_stderr(err_buf):
rb = rota.to_rota_builder()
# build the model and optionally solve
rb.build_and_solve(solve=builder_solve)
# If the rota has solver options saved in rota.options, prefer
# those when invoking the builder. `solver_options` is expected
# to be a dict of solver-specific options; `solver` may be a
# string naming the solver plugin.
opts = rota.options or {}
solver_options = opts.get("solver_options") or {}
solver_name = opts.get("solver") or None
# build the model and optionally solve. If solver_name is
# provided, pass it through; otherwise let builder default.
if solver_name:
rb.build_and_solve(options=solver_options, solve=builder_solve, solver=solver_name)
else:
rb.build_and_solve(options=solver_options, solve=builder_solve)
html = rb.get_worker_timetable_html(include_html_tag=True)
# store under result so it's accessible from UI