From 6d5cf24269718a25c189d9cc2578cc0dfb8ee6d3 Mon Sep 17 00:00:00 2001 From: Pedro Crespo <32402063+pcrespov@users.noreply.github.com> Date: Thu, 1 Dec 2022 19:07:37 +0100 Subject: [PATCH] fix: retry only with 404 --- tests/public-api/test_solvers_jobs_api.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/public-api/test_solvers_jobs_api.py b/tests/public-api/test_solvers_jobs_api.py index 71653f8684d3..83250c63c69e 100644 --- a/tests/public-api/test_solvers_jobs_api.py +++ b/tests/public-api/test_solvers_jobs_api.py @@ -23,6 +23,7 @@ from osparc.models import File, Job, JobInputs, JobOutputs, JobStatus, Solver from tenacity import Retrying, TryAgain from tenacity.after import after_log +from tenacity.retry import retry_if_exception_type from tenacity.stop import stop_after_attempt from tenacity.wait import wait_fixed @@ -179,10 +180,12 @@ def test_create_job( _RETRY_POLICY_IF_LOGFILE_NOT_FOUND = dict( - reraise=True, + # only 404 are retried, the rest are failures + retry=retry_if_exception_type(TryAgain), wait=wait_fixed(1), stop=stop_after_attempt(5), after=after_log(logger, logging.WARNING), + reraise=True, ) @@ -283,8 +286,8 @@ def test_run_job( print("Testing output logfile ...") # NOTE: https://github.com/itisfoundation/osparc-simcore/issues/3569 shows - # that this test might not have the logs ready in time and returns a 404 - # for that reason we make a retry + # that this test might not have the logs ready in time and returns a 404 (not found) + # for that reason we do a few retries before giving up for attempt in Retrying(_RETRY_POLICY_IF_LOGFILE_NOT_FOUND): with attempt: try: