Add standardized start/stop scripts and mu2edaq-discovery support#3
Open
normanajn wants to merge 1 commit into
Open
Add standardized start/stop scripts and mu2edaq-discovery support#3normanajn wants to merge 1 commit into
normanajn wants to merge 1 commit into
Conversation
- 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>
There was a problem hiding this comment.
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.shto 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_LISTENenvironment override. - Added optional
mu2edaq_discovery.Responderannouncement 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1, fixes #2.
start-mu2edaq-dataformat-viewer.sh/stop-mu2edaq-dataformat-viewer.shfor the control room shared bin area: start backgrounds the PyQt6 GUI withDISPLAYinherited 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.CRS_PORT_LISTENenv override exported by the control roomcrs-applauncher (default unchanged: 7755).mu2edaq_discovery.Responder(appdataformat-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