Skip to content

Add cross-platform Python launcher (launch.py) as alternative to start_all.sh#23

Open
user3868 wants to merge 1 commit intoOpenBMB:mainfrom
user3868:add-python-launcher
Open

Add cross-platform Python launcher (launch.py) as alternative to start_all.sh#23
user3868 wants to merge 1 commit intoOpenBMB:mainfrom
user3868:add-python-launcher

Conversation

@user3868
Copy link
Copy Markdown

Motivation

start_all.sh relies on bash, which does not work on Windows natively and can fail in certain WSL configurations. This PR adds launch.py, a pure-Python alternative that works on Linux, macOS, and Windows (WSL or native) with no extra dependencies beyond the standard library.

What this PR adds

  • launch.py — a single-file Python launcher requiring no additional dependencies
  • Reads gateway_port and worker_base_port from config.json, consistent with start_all.sh
  • Waits for model_loaded: true in each worker's /health response before starting the gateway (same logic as start_all.sh)
  • Streams color-coded real-time output from each worker and the gateway to the terminal
  • Saves PIDs to tmp/launch.pids for clean shutdown via --stop or Ctrl-C

Usage

# After install.sh, instead of start_all.sh:
python launch.py

# Specific GPUs:
CUDA_VISIBLE_DEVICES=0,1 python launch.py
# or
python launch.py --gpus 0,1

# HTTP mode (not recommended — browser mic/camera require HTTPS):
python launch.py --http

# Stop all services:
python launch.py --stop

CLI options

Flag Default Description
--gpus CUDA_VISIBLE_DEVICES or 0 Comma-separated GPU IDs
--http off Use HTTP instead of HTTPS
--python auto-detected Path to Python interpreter
--worker-timeout 600 Seconds to wait for model load
--stop Gracefully stop a running instance

Tested on

  • Ubuntu 22.04 via WSL2 on Windows 10

…t_all.sh

- Pure Python, no bash required; works on Linux, macOS and Windows (WSL/native)
- Reads service ports from config.json (same source as start_all.sh via config.py)
- Supports --gpus, --http, --python, --stop and --worker-timeout flags
- Streams colored real-time output from each worker and the gateway
- Waits for model_loaded=true in /health response before starting the gateway
- Saves PIDs to tmp/launch.pids for clean shutdown via --stop or Ctrl-C
@bokesyo
Copy link
Copy Markdown
Collaborator

bokesyo commented Mar 15, 2026

Hello @user3868 , thank you for this PR! I think it's very helpful and easy-to-understand, and I will test it on my linux server, after that I will merge this PR. Thank you! 🤗

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.

3 participants