From 8cb38f39f8948fbb5e48298f63e0ec63ec982bef Mon Sep 17 00:00:00 2001 From: Almaz <79905215+almazgimaev@users.noreply.github.com> Date: Thu, 20 Jun 2024 10:29:32 +0200 Subject: [PATCH] Upgrade Supervisely SDK to v6.73.111. Added Exception Handler for container crashes (#75) --- agent/worker/task_logged.py | 18 ++++++++++++++---- dev-requirements.txt | 2 +- requirements.txt | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/agent/worker/task_logged.py b/agent/worker/task_logged.py index abf122f..b5b42c5 100644 --- a/agent/worker/task_logged.py +++ b/agent/worker/task_logged.py @@ -125,15 +125,25 @@ def end_log_stop(self): return sly.EventType.TASK_STOPPED def end_log_crash(self, e): - exc_str = traceback.format_exc() + from supervisely.io.exception_handlers import handle_exception + + trace_str = traceback.format_exc() + + handled_exc = handle_exception(e) + if handled_exc is not None: + exit_status = handled_exc.title + exc_str = handled_exc.get_message_for_exception() + else: + exit_status = str(e) + exc_str = repr(e) self.logger.warn( "TASK_END", extra={ "event_type": sly.EventType.TASK_CRASHED, - "exit_status": str(e), - "exc_str": repr(e), - "trace": exc_str, + "exit_status": exit_status, + "exc_str": exc_str, + "trace": trace_str, }, ) return sly.EventType.TASK_CRASHED diff --git a/dev-requirements.txt b/dev-requirements.txt index e301eb0..f3bcaeb 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -7,7 +7,7 @@ grpcio-tools==1.47.0 # py3exiv2==0.9.3 packaging==21.3 version-parser==1.0.1 -supervisely==6.72.203 +supervisely==6.73.111 docker==3.3.0 black python-slugify==6.1.2 diff --git a/requirements.txt b/requirements.txt index 9c8ca7c..6c74b65 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,6 +17,6 @@ filelock==3.13.1 torch==1.7.1+cu110 torchvision==0.8.2+cu110 -f https://download.pytorch.org/whl/torch_stable.html -supervisely==6.73.24 +supervisely==6.73.111 # for development # supervisely @ git+https://github.com/supervisely/supervisely.git@dev-branch