Skip to content

Parallel-SpotOptim UX: real progress labels, TensorBoard tuning visualization, write_image-safe figures#195

Merged
bartzbeielstein merged 4 commits into
developfrom
feat/parallel-tuning-ux
Jun 7, 2026
Merged

Parallel-SpotOptim UX: real progress labels, TensorBoard tuning visualization, write_image-safe figures#195
bartzbeielstein merged 4 commits into
developfrom
feat/parallel-tuning-ux

Conversation

@bartzbeielstein
Copy link
Copy Markdown
Collaborator

Summary

Four commits fixing/finishing the parallel-tuning experience:

  1. fix(model_selection)config k/N progress labels were frozen at config 1/N under SpotOptim n_jobs != 1: every evaluation runs in a worker holding a dill copy of the closure, so parent-side list length never advances. A multiprocessing.Manager counter+lock (proxies survive the dill round-trip and reconnect from spawned workers) provides the true cross-process count. The parent-side SpotOptim trials bar is sequential-only (its worker dill-copies printed stale bars).
  2. feat(multitask) — TensorBoard tuning visualization: SpotOptimStrategy forwards optional config attrs tensorboard_log/path/clean through kwargs_spotoptim into SpotOptim. Set as plain attributes (cfg.tensorboard_log = True) — sf2-safe untouched. Docs section added to spotoptim_intro.qmd.
  3. fix(plots) — prediction figures are now built JSON-safe (datetime → ISO strings), so direct fig.write_image() no longer dies with Type is not JSON serializable: Timestamp (kaleido v1/orjson). A pio.from_json round-trip was rejected: plotly 6 re-encodes arrays as base64 bdata, breaking trace.y consumers.
  4. build(deps)spotoptim>=0.12.8 (logs infill evals parent-side in parallel runs) so live TB works under n_jobs=-1; ungates the end-to-end test.

Verification

  • uv run pytest tests/ -q: 1165 passed (incl. end-to-end: parallel run with tensorboard_log=True produces event files against released spotoptim 0.12.8; progress-label integration test fails on pre-fix code)
  • ruff clean; quartodoc build + full quarto render --no-cache green

🤖 Generated with Claude Code

bartzbeielstein and others added 4 commits June 7, 2026 14:34
…l SpotOptim search

With SpotOptim n_jobs != 1 every objective evaluation runs in a worker
process holding a dill copy of the closure, so a label derived from
len(all_params) was stuck at 'config 1/N' on every bar. A
multiprocessing.Manager counter + lock (whose proxies survive the dill
round-trip and reconnect from spawned workers) now provides the true
cross-process evaluation count. The parent-side 'SpotOptim trials' bar
is created in sequential mode only — in parallel mode its update() ran
on worker dill-copies and the parent bar printed a stale 0% line.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…mStrategy

Forward optional config attributes tensorboard_log / tensorboard_path /
tensorboard_clean through kwargs_spotoptim into the SpotOptim
constructor. Users set them as plain attributes on the config (the safe
package's config classes carry no __slots__), so spotforecast2_safe
stays untouched. Unset attributes are skipped so SpotOptim's own
defaults remain in charge. Live per-eval scalars under parallel tuning
(n_jobs_spotoptim != 1) require spotoptim >= 0.12.8, which logs infill
evaluations parent-side; the real-run test skips on older versions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kaleido v1 serialises figures via orjson, which rejects the raw pandas
Timestamps that tz-aware indexes leave in trace x arrays (object dtype)
and in shapes/annotations/axis ranges — any direct fig.write_image()
call failed with 'Type is not JSON serializable: Timestamp'. Coerce all
datetime values to ISO-8601 strings at figure-build time (date axes
accept them natively; rendering unchanged). save_to_file keeps its JSON
round-trip for traces added after make_plot().

A full pio.from_json(fig.to_json()) round-trip was rejected: plotly 6
re-encodes numeric arrays as base64 bdata dicts, breaking consumers
that read trace.y.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0.12.8 logs infill evaluations parent-side in steady-state parallel
runs; with the floor bump the tuning-visualization feature is live
under n_jobs != 1 and the gated end-to-end test executes. Also add a
commented uv.sources template for a local editable spotoptim.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@bartzbeielstein bartzbeielstein merged commit fbe7cac into develop Jun 7, 2026
9 checks passed
@bartzbeielstein bartzbeielstein deleted the feat/parallel-tuning-ux branch June 7, 2026 13:14
@bartzbeielstein
Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version 5.1.0-rc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@bartzbeielstein
Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version 5.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant