diff --git a/buildflow/core/app/runtime/server.py b/buildflow/core/app/runtime/server.py index a1fc57fa..3b85af57 100644 --- a/buildflow/core/app/runtime/server.py +++ b/buildflow/core/app/runtime/server.py @@ -7,7 +7,6 @@ import uvicorn from fastapi import APIRouter, FastAPI from fastapi.responses import HTMLResponse, JSONResponse -from ray import kill from buildflow.core.app.flow_state import FlowState from buildflow.core.app.infra.actors.infra import InfraActor @@ -115,7 +114,9 @@ async def runtime_snapshot(self): return JSONResponse(snapshot.as_dict()) async def runtime_stop(self): - kill(self.runtime_actor) + # Send two drain requests to stop the runtime. + self.runtime_actor.drain.remote() + self.runtime_actor.drain.remote() async def runtime_status(self): status = await self.runtime_actor.status.remote()