Фикс controlplane
This commit is contained in:
@@ -65,11 +65,16 @@ class RuntimeManager:
|
|||||||
if not self._started:
|
if not self._started:
|
||||||
return
|
return
|
||||||
self._state = LifecycleState.STOPPING
|
self._state = LifecycleState.STOPPING
|
||||||
self.workers.stop(timeout=timeout, force=force)
|
try:
|
||||||
if stop_control_plane:
|
self.workers.stop(timeout=timeout, force=force)
|
||||||
self.control_plane.stop()
|
except TimeoutError:
|
||||||
self._started = False
|
# Do not leave runtime in STOPPING forever for control-plane callers.
|
||||||
self._state = LifecycleState.STOPPED
|
self.workers.stop(force=True)
|
||||||
|
finally:
|
||||||
|
if stop_control_plane:
|
||||||
|
self.control_plane.stop()
|
||||||
|
self._started = False
|
||||||
|
self._state = LifecycleState.STOPPED
|
||||||
|
|
||||||
def status(self) -> dict[str, object]:
|
def status(self) -> dict[str, object]:
|
||||||
self._refresh_state()
|
self._refresh_state()
|
||||||
@@ -85,13 +90,15 @@ class RuntimeManager:
|
|||||||
async def start_runtime(self) -> str:
|
async def start_runtime(self) -> str:
|
||||||
if self._started:
|
if self._started:
|
||||||
return "runtime already running"
|
return "runtime already running"
|
||||||
|
if self.workers.lifecycle_state() == LifecycleState.STOPPING:
|
||||||
|
return "runtime is stopping"
|
||||||
self.start(start_control_plane=False)
|
self.start(start_control_plane=False)
|
||||||
return "runtime started"
|
return "runtime started"
|
||||||
|
|
||||||
async def stop_runtime(self) -> str:
|
async def stop_runtime(self) -> str:
|
||||||
if not self._started:
|
if not self._started:
|
||||||
return "runtime already stopped"
|
return "runtime already stopped"
|
||||||
self.stop(stop_control_plane=False)
|
self.stop(timeout=0.0, stop_control_plane=False)
|
||||||
return "runtime stopped"
|
return "runtime stopped"
|
||||||
|
|
||||||
async def runtime_status(self) -> str:
|
async def runtime_status(self) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user