Skip to content

Commit

Permalink
Protect against engine initialization failure (#70)
Browse files Browse the repository at this point in the history
* recover from engine init error

* remove unused structlog import

* fix
  • Loading branch information
masahi authored Nov 20, 2023
1 parent 43c8ebb commit 4d75375
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions serve/mlc_serve/engine/staging_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,14 @@ def __init__(
)

def start(self):
self.worker_process.start()
if not self.ready_event.wait(timeout=180):
raise RuntimeError(
"StagingInferenceEngine worker is not ready before timeout."
)
try:
self.worker_process.start()
if not self.ready_event.wait(timeout=90):
raise RuntimeError(
"StagingInferenceEngine worker is not ready before timeout."
)
except:
raise RuntimeError("Failed to start StagingInferenceEngine worker process.")

def stop(self):
self.command_queue.put(ShutdownCommand())
Expand Down
2 changes: 1 addition & 1 deletion serve/mlc_serve/engine/staging_engine_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from .base import FinishReason, RequestId, RequestState
from .model_module import DecodeRequest, ModelModule, PrefillRequest, SequenceId
import structlog


logger = logging.getLogger(__name__)

Expand Down

0 comments on commit 4d75375

Please sign in to comment.