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

Show more error messages for warmup errors #932

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Changes from all commits
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
23 changes: 17 additions & 6 deletions python/sglang/srt/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,24 @@ def _wait_and_warmup(server_args, pipe_finish_writer):
headers["Authorization"] = f"Bearer {server_args.api_key}"

# Wait until the server is launched
success = False
for _ in range(120):
time.sleep(1)
try:
requests.get(url + "/get_model_info", timeout=5, headers=headers)
res = requests.get(url + "/get_model_info", timeout=5, headers=headers)
assert res.status_code == 200, f"{res}"
success = True
break
except requests.exceptions.RequestException:
except (AssertionError, requests.exceptions.RequestException) as e:
last_traceback = get_exception_traceback()
pass

if not success:
if pipe_finish_writer is not None:
pipe_finish_writer.send(last_traceback)
print(f"Initialization failed. warmup error: {last_traceback}", flush=True)
sys.exit(1)

# Send a warmup request
try:
for _ in range(server_args.dp_size):
Expand All @@ -390,12 +400,13 @@ def _wait_and_warmup(server_args, pipe_finish_writer):
headers=headers,
timeout=600,
)
assert res.status_code == 200
assert res.status_code == 200, f"{res}"
except Exception as e:
last_traceback = get_exception_traceback()
if pipe_finish_writer is not None:
pipe_finish_writer.send(get_exception_traceback())
print(f"Initialization failed. warmup error: {e}", flush=True)
raise e
pipe_finish_writer.send(last_traceback)
print(f"Initialization failed. warmup error: {last_traceback}", flush=True)
sys.exit(1)

logger.info("The server is fired up and ready to roll!")
if pipe_finish_writer is not None:
Expand Down
Loading