Skip to content

Add top-level standardized start/stop scripts and mu2edaq-discovery support#7

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

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

Conversation

@normanajn

Copy link
Copy Markdown
Contributor

Fixes #5, fixes #6.

  • Adds top-level start-mu2edaq-resource-manager.sh (wraps the existing scripts/start_server.sh, backgrounds it with a PID file, and maps the control room CRS_PORT_HTTP override onto RM_PORT) and stop-mu2edaq-resource-manager.sh (PID-file kill with a by-name fallback, no-op success when not running). scripts/start_server.sh is unchanged for existing users.
  • Announces via mu2edaq_discovery.Responder (name "Resource Manager", app resource-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

- 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>
Copilot AI review requested due to automatic review settings June 12, 2026 20:20

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

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.sh to wrap/background the existing scripts/start_server.sh, persist a PID file, and map CRS_PORT_HTTPRM_PORT.
  • Add stop-mu2edaq-resource-manager.sh to stop the server via PID file (with a by-name fallback).
  • Add a mu2edaq_discovery.Responder startup hook and add mu2edaq-discovery to 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 thread server/app.py
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"
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 Move scripts/start_server.sh to top-level start-mu2edaq-resource-manager.sh and add a stop script

2 participants