Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Handle server startup failure in __enter__ #274

Merged
merged 1 commit into from
May 31, 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
13 changes: 9 additions & 4 deletions tests/utils/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,15 @@ def __enter__(self):
ray.init(ignore_reinit_error=True)
log_banner(self._logger, "server startup command args",
shlex.join(self._args))
self.server_runner = ServerRunner.remote(self._args,
logger=self._logger)
ray.get(self.server_runner.ready.remote())
return self.server_runner

try:
self.server_runner = ServerRunner.remote(self._args,
logger=self._logger)
ray.get(self.server_runner.ready.remote())
return self.server_runner
except Exception as e:
self.__exit__(*sys.exc_info())
raise e

def __exit__(self, exc_type, exc_value, exc_traceback):
"""
Expand Down
Loading