Add top-level standardized start/stop scripts and mu2edaq-discovery support#7
Open
normanajn wants to merge 1 commit into
Open
Add top-level standardized start/stop scripts and mu2edaq-discovery support#7normanajn wants to merge 1 commit into
normanajn wants to merge 1 commit into
Conversation
- start-mu2edaq-resource-manager.sh wraps scripts/start_server.sh with PID tracking and the CRS_PORT_HTTP env override mapped onto RM_PORT; stop-mu2edaq-resource-manager.sh added (fixes #5) - Announce via mu2edaq-discovery before uvicorn starts; optional dependency (fixes #6) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds standardized top-level start/stop launcher scripts for the Resource Manager (for control room integration) and introduces service auto-discovery support via mu2edaq-discovery so the service can be found by discovery tools.
Changes:
- Add
start-mu2edaq-resource-manager.shto wrap/background the existingscripts/start_server.sh, persist a PID file, and mapCRS_PORT_HTTP→RM_PORT. - Add
stop-mu2edaq-resource-manager.shto stop the server via PID file (with a by-name fallback). - Add a
mu2edaq_discovery.Responderstartup hook and addmu2edaq-discoveryto dependencies.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
start-mu2edaq-resource-manager.sh |
New top-level launcher with PID/log handling and control room port override mapping. |
stop-mu2edaq-resource-manager.sh |
New stop script that kills by PID-file (and falls back to a name-based kill). |
server/app.py |
Adds discovery responder startup integration before launching Uvicorn. |
requirements.txt |
Adds mu2edaq-discovery dependency via a Git URL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+142
to
150
| # Announce via mu2edaq-discovery (optional dependency). | ||
| try: | ||
| from mu2edaq_discovery import Responder | ||
| Responder(name="Resource Manager", app="resource-manager", | ||
| port=args.port, scheme="http").start() | ||
| except ImportError: | ||
| print("mu2edaq-discovery not installed; discovery disabled") | ||
|
|
||
| uvicorn.run(app, host=args.host, port=args.port) |
Comment on lines
+9
to
+11
| # start_server.sh execs python, so the PID is the server itself, | ||
| # but kill the process group to be safe with shells in between. | ||
| kill "$PID" 2>/dev/null || true |
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| PID_FILE="/tmp/mu2edaq-resource-manager.pid" |
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 #5, fixes #6.
start-mu2edaq-resource-manager.sh(wraps the existingscripts/start_server.sh, backgrounds it with a PID file, and maps the control roomCRS_PORT_HTTPoverride ontoRM_PORT) andstop-mu2edaq-resource-manager.sh(PID-file kill with a by-name fallback, no-op success when not running).scripts/start_server.shis unchanged for existing users.mu2edaq_discovery.Responder(name "Resource Manager", appresource-manager) just before uvicorn binds. Optional dependency; without it the server prints a note and runs normally.Part of the control room integration (mu2edaq-controlroom-setup).
🤖 Generated with Claude Code