Skip to content

Live optimization progress display in auto3d run - #108

Merged
isayev merged 2 commits into
mainfrom
feat/live-progress
Jun 13, 2026
Merged

Live optimization progress display in auto3d run#108
isayev merged 2 commits into
mainfrom
feat/live-progress

Conversation

@isayev

@isayev isayev commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Wires the unused OptimizationDisplay into interactive auto3d run, replacing the static spinner with a live panel (converged/active/dropped/step). The hard part is that optimization runs in spawned worker processes while the main process blocks in join(); this pushes per-step counts out over a process-safe channel and renders them in the main process.

Design — strictly opt-in, risk confined to auto3d run

  • Optional progress_callback threaded main()WorkflowOrchestrator → workers. When None (every Python-API caller, tests, and --quiet/--json), the pipeline behaves byte-for-byte as before — no progress queue, plain blocking joins, no extra GPU syncs. The spawn/CUDA isolation and "Done"-sentinel logic are untouched on the default path.
  • When set: _run_pipeline creates an unbounded Manager().Queue(), the worker builds a job-tagging closure, and n_steps emits {step,total,converged,dropped,active} (via the extracted optimization_counts, shared with print_stats) on the existing istep % 10 cadence. The main process runs a supervise-and-drain loop, forwarding events to a Rich Live panel, then joins with the same exit-code checks.

Review

An independent concurrency/correctness review found no Critical/Major issues — deadlock-safety confirmed (liveness-driven loop, unbounded synchronous Manager queue, guarded puts, sentinels intact) and default-path invariance confirmed. Two Minor cosmetic notes on multi-chunk/multi-GPU percent aggregation are scoped by the docstrings (chunk-level totals were deferred).

Fast gate: 681 passed (+12 new: count helper, display aggregation, callback forwarding); ruff clean on src/. Guarded so a render error can never abort a run.

This is the last item from the CLI review backlog.

isayev added 2 commits June 13, 2026 11:33
Thread an optional progress callback from main()/WorkflowOrchestrator down to the
FIRE loop so the optimizer can report per-step counts without coupling the math
layers to multiprocessing:

- n_steps emits {step,total,converged,dropped,active} (via the extracted
  optimization_counts, shared with print_stats) on the existing istep % 10 sync
  cadence + a final event, only when a callback is supplied.
- ensemble_opt / optimizing forward an opaque progress_cb; optim_rank_wrapper
  builds a job-tagging closure over an unbounded Manager progress queue.
- WorkflowOrchestrator gains an optional progress_callback. When set,
  _run_pipeline creates the progress queue and runs a supervise-and-drain loop
  (forwarding events while workers run, then joining with the same exit-code
  checks); when None, the existing blocking-join path runs unchanged.

Strictly opt-in: with no callback (every library/test caller) the pipeline
behaves exactly as before -- no queue, no emits, no extra syncs. Test stubs that
mock the optimizer/orchestrator/ensemble_opt gain the new optional parameter.
Interactive runs now render a Rich Live panel (converged/active/dropped/step)
fed by the optimizer progress events, replacing the static spinner.
OptimizationDisplay.update_from_jobs aggregates the latest per-job event (sums
counts, shows the furthest step) so a single optimizer renders its own progress
and multi-GPU shows a sensible aggregate. --quiet/--json pass no callback, so
stdout stays clean for piping; the render path is fully guarded so a display
error can never abort a run. Adds unit tests for the count helper and display
aggregation, and CLI tests asserting the callback is forwarded (interactive) and
withheld (quiet).
@isayev
isayev merged commit c0d3332 into main Jun 13, 2026
8 checks passed
@isayev
isayev deleted the feat/live-progress branch June 13, 2026 15:39
isayev added a commit that referenced this pull request Jul 11, 2026
Live optimization progress display in auto3d run
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