Add start/stop wrapper scripts with port overrides and discovery sidecar - #3
Open
normanajn wants to merge 1 commit into
Open
Add start/stop wrapper scripts with port overrides and discovery sidecar#3normanajn wants to merge 1 commit into
normanajn wants to merge 1 commit into
Conversation
- start-mu2edaq-trigger-scalers.sh locates the built binary, inherits DISPLAY, and maps CRS_PORT_UDP/CRS_PORT_ZMQ onto the existing --udp-port/--zmq-port options (control room assigns UDP 5557 to avoid the dashboard ZMQ 5555 clash) (fixes #1) - Python mu2edaq-discovery responder runs as a sidecar until the native C++ library exists; stop kills the sidecar first (fixes #2) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds operational wrapper scripts to start/stop the trigger-scalers Qt GUI with control-room port overrides and an interim service-discovery sidecar, supporting control room integration without requiring C++ changes.
Changes:
- Add
start-mu2edaq-trigger-scalers.shto locate/runbuild/trigger-scalers, mapCRS_PORT_UDP/CRS_PORT_ZMQto CLI overrides, and launch a Python discovery responder sidecar. - Add
stop-mu2edaq-trigger-scalers.shto stop the GUI and sidecar via pidfiles with a by-name fallback.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| start-mu2edaq-trigger-scalers.sh | Starts the GUI with env-driven port overrides and launches a Python discovery sidecar. |
| stop-mu2edaq-trigger-scalers.sh | Stops the sidecar first, then the GUI, using pidfiles and a name-based fallback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+10
to
+12
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| PID_FILE="/tmp/trigger-scalers.pid" | ||
| DISC_PID_FILE="/tmp/trigger-scalers-responder.pid" |
Comment on lines
+30
to
+32
| nohup "$BINARY" "${ARGS[@]}" "$@" >> /tmp/trigger-scalers.log 2>&1 & | ||
| echo $! > "$PID_FILE" | ||
| echo "Trigger Scalers started (PID $(cat "$PID_FILE"))." |
Comment on lines
+36
to
+49
| python3 - "${CRS_PORT_UDP:-5555}" "${CRS_PORT_ZMQ:-5556}" >/dev/null 2>&1 <<'PYEOF' & | ||
| import signal, sys | ||
| try: | ||
| from mu2edaq_discovery import Responder | ||
| except ImportError: | ||
| sys.exit(0) | ||
| r = Responder(name="Trigger Scalers", app="trigger-scalers", | ||
| port=int(sys.argv[1]), scheme="udp", | ||
| meta={"zmq_port": sys.argv[2]}) | ||
| r.start() | ||
| signal.signal(signal.SIGTERM, lambda *a: sys.exit(0)) | ||
| signal.pause() | ||
| PYEOF | ||
| echo $! > "$DISC_PID_FILE" |
Comment on lines
+5
to
+6
| PID_FILE="/tmp/trigger-scalers.pid" | ||
| DISC_PID_FILE="/tmp/trigger-scalers-responder.pid" |
| rm -f "$PID_FILE" | ||
| echo "Trigger Scalers stopped." | ||
| else | ||
| PIDS=$(pgrep -x "trigger-scalers" || true) |
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-trigger-scalers.sh: locatesbuild/trigger-scalers, inheritsDISPLAYfrom the invoking VNC session, and maps the control roomCRS_PORT_UDP/CRS_PORT_ZMQenv overrides onto the binary's existing--udp-port/--zmq-portoptions (no C++ changes needed — the CLI plumbing was already there). The control room app inventory assigns UDP 5557 to avoid the mu2edaq-dashboard ZMQ 5555 clash; repo defaults are unchanged.stop-mu2edaq-trigger-scalers.sh(PID-file kill, by-name fallback, no-op success).mu2edaq_discovery.Respondersidecar started by the start script — the interim approach from Add discovery support (blocked on mu2edaq-discovery C++ library) #2 until the native C++ library lands in mu2edaq-discovery (protocol is plain JSON over UDP, so a futureQUdpSocketport is mechanical). The sidecar exits silently when the package isn't installed; the stop script kills it before the app so discovery never advertises a dead display.Part of the control room integration (mu2edaq-controlroom-setup).
🤖 Generated with Claude Code