Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Serving] fix hardcoded host and port in popen_server #2147

Merged
merged 4 commits into from
Apr 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions python/mlc_llm/serve/server/popen_server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""The MLC LLM server launched in a subprocess."""

import subprocess
import os
import sys
import time
from pathlib import Path
Expand Down Expand Up @@ -79,13 +80,13 @@ def start(self) -> None: # pylint: disable=too-many-branches
cmd += ["--host", self.host]
cmd += ["--port", str(self.port)]
process_path = str(Path(__file__).resolve().parents[4])
self._proc = subprocess.Popen(cmd, cwd=process_path) # pylint: disable=consider-using-with
self._proc = subprocess.Popen(cmd, cwd=process_path, env=os.environ) # pylint: disable=consider-using-with
# NOTE: DO NOT USE `stdout=subprocess.PIPE, stderr=subprocess.PIPE`
# in subprocess.Popen here. PIPE has a fixed-size buffer with may block
# and hang forever.

# Try to query the server until it is ready.
openai_v1_models_url = "http://127.0.0.1:8000/v1/models"
openai_v1_models_url = f"http://{self.host}:{str(self.port)}/v1/models"
query_result = None
timeout = 60
attempts = 0.0
Expand Down
Loading