Terminate process when main process raises error in ServableModuleValidator (#14217)

Co-authored-by: otaj <6065855+otaj@users.noreply.github.com>
This commit is contained in:
Adrian Wälchli 2022-08-17 21:08:41 +02:00 committed by GitHub
parent 1745d192f9
commit 7d17310966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -27,7 +27,7 @@ jobs:
- {python-version: "3.8", pytorch-version: "1.10"}
- {python-version: "3.9", pytorch-version: "1.11"}
- {python-version: "3.9", pytorch-version: "1.12"}
timeout-minutes: 30
timeout-minutes: 40
steps:
- name: Workaround for https://github.com/actions/checkout/issues/760

View File

@ -47,7 +47,7 @@ class ServableModuleValidator(Callback):
server: Literal["fastapi", "ml_server", "torchserve", "sagemaker"] = "fastapi",
host: str = "127.0.0.1",
port: int = 8080,
timeout: int = 10,
timeout: int = 20,
exit_on_failure: bool = True,
):
super().__init__()
@ -109,7 +109,8 @@ class ServableModuleValidator(Callback):
except requests.exceptions.ConnectionError:
pass
if time.time() - t0 > self.timeout:
raise Exception(f"The Server didn't start in {self.timeout}")
process.kill()
raise Exception(f"The server didn't start within {self.timeout} seconds.")
time.sleep(0.1)
payload = servable_module.configure_payload()