ci : gracefully shut down the server (#21110)
Signed-off-by: Adrien Gallouët <angt@huggingface.co>
This commit is contained in:
@@ -288,7 +288,15 @@ class ServerProcess:
|
|||||||
server_instances.remove(self)
|
server_instances.remove(self)
|
||||||
if self.process:
|
if self.process:
|
||||||
print(f"Stopping server with pid={self.process.pid}")
|
print(f"Stopping server with pid={self.process.pid}")
|
||||||
|
self.process.terminate()
|
||||||
|
try:
|
||||||
|
self.process.wait(timeout=5)
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
print(f"Server pid={self.process.pid} did not terminate in time, killing")
|
||||||
self.process.kill()
|
self.process.kill()
|
||||||
|
self.process.wait(timeout=5)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error waiting for server: {e}")
|
||||||
self.process = None
|
self.process = None
|
||||||
|
|
||||||
def make_request(
|
def make_request(
|
||||||
|
|||||||
Reference in New Issue
Block a user