Skip to content

Commit a279ad1

Browse files
author
Andrei Neagu
committed
fixed broken test for autoretry
1 parent 40a81e9 commit a279ad1

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

services/storage/src/simcore_service_storage/api/rpc/_async_jobs.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,19 @@ async def result(
9595
if _status.task_state == TaskState.ABORTED:
9696
raise JobAbortedError(job_id=job_id)
9797
if _status.task_state == TaskState.ERROR:
98-
# NOTE: recover original error from wrapped error
99-
exception = None
100-
exc_type = None
101-
exc_msg = f"{_result}" # try to deseialise something
98+
# fallback exception to report
99+
exc_type = type(_result).__name__
100+
exc_msg = f"{_result}"
102101

102+
# try to recover the original error
103+
exception = None
103104
with log_catch(_logger, reraise=False):
104105
exception = decode_celery_transferrable_error(_result)
105106
exc_type = type(exception).__name__
106107
exc_msg = f"{exception}"
107108

108109
if exception is None:
109-
_logger.warning("Was not expecting %s", _result)
110+
_logger.warning("Was not expecting '%s': '%s'", exc_type, exc_msg)
110111

111112
# NOTE: cannot transfer original exception since this will not be able to be serialized
112113
# outside of storage

services/storage/src/simcore_service_storage/modules/celery/_task.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ def wrapper(task: AbortableTask, *args: P.args, **kwargs: P.kwargs) -> R:
7171
except Exception as exc:
7272
if isinstance(exc, dont_autoretry_for):
7373
_logger.debug("Not retrying for exception %s", type(exc).__name__)
74-
raise # propagate without retry
74+
# propagate without retry
75+
raise encore_celery_transferrable_error(exc) from exc
7576

7677
exc_type = type(exc).__name__
7778
exc_message = f"{exc}"

0 commit comments

Comments
 (0)