Skip to content

Assign per-instance TensorBoard ports from session_state registry#280

Merged
dsblank merged 2 commits intomasterfrom
dblank/tensorboard-per-instance-ports
Mar 26, 2026
Merged

Assign per-instance TensorBoard ports from session_state registry#280
dsblank merged 2 commits intomasterfrom
dblank/tensorboard-per-instance-ports

Conversation

@dsblank
Copy link
Copy Markdown
Collaborator

@dsblank dsblank commented Mar 26, 2026

Summary

  • Each TensorBoard panel now reads COMET_PANEL_INSTANCE_ID and claims a unique port (6000–6009) from a shared session_state dict instead of all instances hardcoding port 6007
  • A reusable get_instance_port() helper handles port assignment — returns an existing port if the instance has been seen before, or allocates the next available one
  • Raises RuntimeError if all 10 ports are exhausted

Files changed

  • panels/TensorboardProfileViewer.py
  • panels/TensorboardProfileViewer/TensorboardProfileViewer.py
  • panels/TensorboardGroupViewer.py
  • panels/TensorboardGroupViewer/TensorboardGroupViewer.py
  • panels/TensorboardTorchProfilerViewer/TensorboardTorchProfilerViewer.py

Test plan

  • Open multiple TensorBoard panel instances and verify each gets a distinct port
  • Reload an existing instance and verify it reuses its previously assigned port
  • Verify TensorBoard loads correctly in the iframe for each instance

🤖 Generated with Claude Code

Douglas Blank and others added 2 commits March 26, 2026 14:14
Each panel instance now reads COMET_PANEL_INSTANCE_ID and uses a shared
session_state dict to claim a unique port in the range 6000-6009, rather
than all instances hardcoding port 6007. Raises RuntimeError if all 10
ports are exhausted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e experiment objects

Streamlit deepcopies session state when registering widgets, which fails
when experiment objects contain thread locks. Replace direct selectbox
usage with a select_experiment() helper that stores only a picklable
integer index and looks up the experiment by position.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dsblank dsblank merged commit e10acf7 into master Mar 26, 2026
34 of 51 checks passed
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