Skip to content

Commit

Permalink
[CI/Build] Simplify exception trace in api server tests (vllm-project…
Browse files Browse the repository at this point in the history
…#9787)

Signed-off-by: youkaichao <[email protected]>
Co-authored-by: youkaichao <[email protected]>
Signed-off-by: Loc Huynh <[email protected]>
  • Loading branch information
2 people authored and JC1DA committed Nov 11, 2024
1 parent 4639e85 commit 5c2690a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,19 @@ def _wait_for_server(self, *, url: str, timeout: float):
try:
if requests.get(url).status_code == 200:
break
except Exception as err:
except Exception:
# this exception can only be raised by requests.get,
# which means the server is not ready yet.
# the stack trace is not useful, so we suppress it
# by using `raise from None`.
result = self.proc.poll()
if result is not None and result != 0:
raise RuntimeError("Server exited unexpectedly.") from err
raise RuntimeError("Server exited unexpectedly.") from None

time.sleep(0.5)
if time.time() - start > timeout:
raise RuntimeError(
"Server failed to start in time.") from err
"Server failed to start in time.") from None

@property
def url_root(self) -> str:
Expand Down

0 comments on commit 5c2690a

Please sign in to comment.