[Bug] Suppress the SGLang patch error in Ray workers (#93)

This commit is contained in:
Wei Fu 2025-06-08 20:50:56 +08:00 committed by GitHub
parent 54daceb6dc
commit c7d6ccc18e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 5 deletions

View File

@ -41,11 +41,7 @@ def execute_shell_command(command: str) -> subprocess.Popen:
) )
def launch_server_cmd(command: str, port: int = 30000): def apply_sglang_path():
"""
Launch the server using the given command.
If no port is specified, a free port is reserved.
"""
p = Path(os.path.dirname(__file__)) p = Path(os.path.dirname(__file__))
patch_path = str( patch_path = str(
p.parent.parent p.parent.parent
@ -72,6 +68,15 @@ def launch_server_cmd(command: str, port: int = 30000):
) )
proc.wait() proc.wait()
logger.info(f"Applied SGLang patch at {target_path}") logger.info(f"Applied SGLang patch at {target_path}")
def launch_server_cmd(command: str, port: int = 30000):
"""
Launch the server using the given command.
If no port is specified, a free port is reserved.
"""
if not ray.is_initialized():
apply_sglang_path()
assert port is not None assert port is not None
full_command = f"{command} --port {port}" full_command = f"{command} --port {port}"
process = execute_shell_command(full_command) process = execute_shell_command(full_command)