From 32293a299c7aa4c5d985d97bbb1885e5f32e4862 Mon Sep 17 00:00:00 2001 From: Byron Hsu Date: Sat, 23 Nov 2024 17:34:24 -0800 Subject: [PATCH] Improve sglang router (#2148) --- .github/workflows/release-pypi-router.yml | 5 +++++ rust/py_src/sglang_router/launch_server.py | 5 +++-- rust/pyproject.toml | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-pypi-router.yml b/.github/workflows/release-pypi-router.yml index 3484adb54..440802ec1 100644 --- a/.github/workflows/release-pypi-router.yml +++ b/.github/workflows/release-pypi-router.yml @@ -3,6 +3,11 @@ name: Release SGLang Router to PyPI on: + push: + branches: + - main + paths: + - rust/pyproject.toml" workflow_dispatch: jobs: diff --git a/rust/py_src/sglang_router/launch_server.py b/rust/py_src/sglang_router/launch_server.py index 614c870ff..11e58ffaa 100644 --- a/rust/py_src/sglang_router/launch_server.py +++ b/rust/py_src/sglang_router/launch_server.py @@ -2,6 +2,7 @@ import argparse import copy import multiprocessing as mp import os +import random import signal import sys import time @@ -11,7 +12,7 @@ import requests from sglang_router.launch_router import RouterArgs, launch_router from sglang.srt.server import launch_server -from sglang.srt.server_args import ServerArgs, prepare_server_args +from sglang.srt.server_args import ServerArgs from sglang.srt.utils import is_port_available from sglang.utils import get_exception_traceback @@ -94,7 +95,7 @@ def find_available_ports(base_port: int, count: int) -> List[int]: while len(available_ports) < count: if is_port_available(current_port): available_ports.append(current_port) - current_port += 1 + current_port += random.randint(100, 1000) return available_ports diff --git a/rust/pyproject.toml b/rust/pyproject.toml index 7365e24dc..5d878a693 100644 --- a/rust/pyproject.toml +++ b/rust/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "sglang-router" -version = "0.0.6" +version = "0.0.7" description = "SGLang router is a standalone module implemented in Rust to achieve data parallelism across SGLang instances." authors = [{name = "Byron Hsu", email = "byronhsu1230@gmail.com"}] requires-python = ">=3.8"