don't healthcheck endpoints until model is loaded and benchmarks have run
This commit is contained in:
committed by
Nader Arbabian
parent
0ab9a13a46
commit
9ebf1924ea
+6
-1
@@ -60,6 +60,7 @@ class Backend:
|
|||||||
self.metrics = Metrics()
|
self.metrics = Metrics()
|
||||||
self._total_pubkey_fetch_errors = 0
|
self._total_pubkey_fetch_errors = 0
|
||||||
self._pubkey = self._fetch_pubkey()
|
self._pubkey = self._fetch_pubkey()
|
||||||
|
self.__start_healthcheck: bool = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pubkey(self) -> Optional[RSA.RsaKey]:
|
def pubkey(self) -> Optional[RSA.RsaKey]:
|
||||||
@@ -191,7 +192,10 @@ class Backend:
|
|||||||
if health_check_url is None:
|
if health_check_url is None:
|
||||||
log.debug("No healthcheck endpoint defined, skipping healthcheck")
|
log.debug("No healthcheck endpoint defined, skipping healthcheck")
|
||||||
return
|
return
|
||||||
await sleep(5)
|
while True:
|
||||||
|
await sleep(10)
|
||||||
|
if self.__start_healthcheck is False:
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
log.debug(f"Performing healthcheck on {health_check_url}")
|
log.debug(f"Performing healthcheck on {health_check_url}")
|
||||||
async with self.session.get(health_check_url) as response:
|
async with self.session.get(health_check_url) as response:
|
||||||
@@ -331,6 +335,7 @@ class Backend:
|
|||||||
await sleep(5)
|
await sleep(5)
|
||||||
try:
|
try:
|
||||||
max_throughput = await run_benchmark()
|
max_throughput = await run_benchmark()
|
||||||
|
self.__start_healthcheck = True
|
||||||
self.metrics._model_loaded(
|
self.metrics._model_loaded(
|
||||||
max_throughput=max_throughput,
|
max_throughput=max_throughput,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user