From 0f4122247d9220be84b28fe67f4902a4ed4dead7 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Mon, 26 Feb 2024 11:31:58 +0200 Subject: [PATCH] Fix ping serving session task to make sure everyone knows we are alive --- clearml_serving/serving/model_request_processor.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/clearml_serving/serving/model_request_processor.py b/clearml_serving/serving/model_request_processor.py index e7d1103..9c854df 100644 --- a/clearml_serving/serving/model_request_processor.py +++ b/clearml_serving/serving/model_request_processor.py @@ -835,6 +835,8 @@ class ModelRequestProcessor(object): """ Background thread, syncing model changes into request service. """ + from clearml.backend_api.services import tasks + poll_frequency_sec = float(poll_frequency_sec) # force mark started on the main serving service task self._task.mark_started(force=True) @@ -843,6 +845,17 @@ class ModelRequestProcessor(object): model_monitor_update = False self._update_serving_plot() while True: + # noinspection PyBroadException + try: + # make sure we let the serving session know we are alive + self._task.send(tasks.PingRequest(self._task.id)) + except Exception: + # noinspection PyBroadException + try: + self._report_text("Failed pinging serving session id={}".format(self._task.id)) + except Exception as ex: + pass + try: # this should be the only place where we call deserialize self._task.reload()