@@ -48,26 +48,30 @@ def _reboot():
4848 elif reboot :
4949 bus = ServiceRegistry .get (ServiceBus )
5050 for server in [x for x in bus .servers .values () if x .status not in [Status .SHUTDOWN , Status .UNREGISTERED ]]:
51- if not server .is_remote :
52- await bus .send_to_node ({"command" : "onShutdown" , "server_name" : server .name })
53- await asyncio .sleep (1 )
54- await server .shutdown ()
55- if maintenance is not None :
56- server .maintenance = maintenance
51+ if server .is_remote :
52+ continue
53+ await bus .send_to_node ({"command" : "onShutdown" , "server_name" : server .name })
54+ await asyncio .sleep (1 )
55+ await server .shutdown ()
56+ if maintenance is not None :
57+ server .maintenance = maintenance
5758 atexit .register (_reboot )
5859 await node .shutdown ()
5960
6061
61- async def halt (node : Node ):
62+ async def halt (node : Node , maintenance : bool | None = None ):
6263 def _halt ():
6364 os .system ("shutdown /s /t 1" )
6465
6566 bus = ServiceRegistry .get (ServiceBus )
6667 for server in [x for x in bus .servers .values () if x .status not in [Status .SHUTDOWN , Status .UNREGISTERED ]]:
67- if not server .is_remote :
68- await bus .send_to_node ({"command" : "onShutdown" , "server_name" : server .name })
69- await asyncio .sleep (1 )
70- await server .shutdown ()
68+ if server .is_remote :
69+ continue
70+ await bus .send_to_node ({"command" : "onShutdown" , "server_name" : server .name })
71+ await asyncio .sleep (1 )
72+ await server .shutdown ()
73+ if maintenance is not None :
74+ server .maintenance = maintenance
7175 atexit .register (_halt )
7276 await node .shutdown ()
7377
0 commit comments