Skip to content

Add standardized start/stop scripts and mu2edaq-discovery support#3

Open
normanajn wants to merge 1 commit into
mainfrom
controlroom-integration
Open

Add standardized start/stop scripts and mu2edaq-discovery support#3
normanajn wants to merge 1 commit into
mainfrom
controlroom-integration

Conversation

@normanajn

Copy link
Copy Markdown
Contributor

Fixes #1, fixes #2.

  • Adds start-mu2edaq-dataformat-viewer.sh / stop-mu2edaq-dataformat-viewer.sh for the control room shared bin area: start backgrounds the PyQt6 GUI with DISPLAY inherited from the invoking VNC session and writes a PID file; stop kills by PID with a by-name fallback and is a no-op success when nothing runs.
  • The default listen port honors the CRS_PORT_LISTEN env override exported by the control room crs-app launcher (default unchanged: 7755).
  • Announces via mu2edaq_discovery.Responder (app dataformat-viewer) only while actually listening — the responder starts when "Start listening" binds the socket and stops with the server, so discovery never advertises a closed port. Optional dependency; the GUI runs normally without it.

Part of the control room integration (mu2edaq-controlroom-setup).

🤖 Generated with Claude Code

- New start-mu2edaq-dataformat-viewer.sh / stop-mu2edaq-dataformat-viewer.sh
  (fixes #1); DISPLAY honored, PID tracked
- Listen port honors the CRS_PORT_LISTEN env override
- Announce via mu2edaq-discovery only while the listener is active:
  responder starts with the server and stops with it; optional
  dependency (fixes #2)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 12, 2026 20:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds control-room-friendly start/stop wrappers and integrates Mu2e DAQ service discovery so the dataformat viewer can be launched/stopped consistently and (when enabled) advertised only while its listener is active.

Changes:

  • Added start-mu2edaq-dataformat-viewer.sh / stop-mu2edaq-dataformat-viewer.sh to launch the PyQt6 GUI in the background and stop it via PID (with a by-name fallback).
  • Made the default listen port honor the CRS_PORT_LISTEN environment override.
  • Added optional mu2edaq_discovery.Responder announcement that starts/stops with the viewer’s listening socket.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
start-mu2edaq-dataformat-viewer.sh New launcher script that backgrounds the GUI and writes a PID/log file.
stop-mu2edaq-dataformat-viewer.sh New stopper script that kills by PID with a by-name fallback and no-op success when not running.
requirements.txt Adds mu2edaq-discovery dependency via a Git URL.
mu2edaq-dataformat-viewer.py Adds CRS_PORT_LISTEN override handling and starts/stops mu2edaq_discovery.Responder alongside the listener.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 240 to 243
viewer_cfg = self._cfg.get("viewer", {})
port = viewer_cfg.get("port", 7755)
port = int(os.environ.get("CRS_PORT_LISTEN",
viewer_cfg.get("port", 7755)))
self._port_edit.setText(str(port))
Comment on lines +1003 to +1013
def _start_responder(self, port, proto):
"""Announce the listener via mu2edaq-discovery (optional dependency).
Started only while actually listening, stopped with the server."""
try:
from mu2edaq_discovery import Responder
except ImportError:
return
self._responder = Responder(
name="Data Format Viewer", app="dataformat-viewer",
port=port, scheme=proto.lower())
self._responder.start()
Comment on lines 1015 to +1019
def _stop_server(self):
responder = getattr(self, "_responder", None)
if responder is not None:
responder.stop()
self._responder = None
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.

Add mu2edaq-discovery auto-discovery support Add start-mu2edaq-dataformat-viewer.sh / stop-mu2edaq-dataformat-viewer.sh

2 participants