From 86752f583fe252b428c5f1178789cbdb3425922a Mon Sep 17 00:00:00 2001 From: Karel Srot Date: Thu, 18 Jul 2024 09:36:29 +0200 Subject: [PATCH] Retry on error 504 from ReportPortal --- tmt/steps/report/reportportal.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tmt/steps/report/reportportal.py b/tmt/steps/report/reportportal.py index 6b08daf364..573ad2a229 100644 --- a/tmt/steps/report/reportportal.py +++ b/tmt/steps/report/reportportal.py @@ -226,13 +226,13 @@ class ReportReportPortal(tmt.steps.report.ReportPlugin[ReportReportPortalData]): def handle_response(self, response: requests.Response) -> None: """ Check the endpoint response and raise an exception if needed """ - if not response.ok: - raise tmt.utils.ReportError( - f"Received non-ok status code from ReportPortal: {response.text}") - self.debug("Response code from the endpoint", response.status_code) self.debug("Message from the endpoint", response.text) + if not response.ok: + raise tmt.utils.ReportError( + f"Received non-ok status code {response.status_code} from ReportPortal: {response.text}") + def check_options(self) -> None: """ Check options for known troublesome combinations """ # TODO: Update restriction of forbidden option combinations based on feedback. @@ -393,7 +393,13 @@ def go(self, *, logger: Optional[tmt.log.Logger] = None) -> None: suite_description += f"
{self.data.artifacts_url}" # Communication with RP instance - with tmt.utils.retry_session() as session: + with tmt.utils.retry_session(status_forcelist=( + 429, # Too Many Requests + 500, # Internal Server Error + 502, # Bad Gateway + 503, # Service Unavailable + 504, # Gateway Timeout + )) as session: if create_launch: