From 2db46b5c48789eaef37738c83ace5b751b921ad0 Mon Sep 17 00:00:00 2001 From: Jakob Duus Terkelsen <36190025+jduust@users.noreply.github.com> Date: Wed, 12 Feb 2025 12:44:17 +0100 Subject: [PATCH 1/3] Update config.py added queue_attempts to config --- robot_framework/config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/robot_framework/config.py b/robot_framework/config.py index d03e67a..6bfc9e7 100644 --- a/robot_framework/config.py +++ b/robot_framework/config.py @@ -3,6 +3,9 @@ # The number of times the robot retries on an error before terminating. MAX_RETRY_COUNT = 3 +# Number of attempts per queue_element (1 is no retry, 2 is 2 total attempts and so on) +QUEUE_ATTEMPTS = 1 + # Whether the robot should be marked as failed if MAX_RETRY_COUNT is reached. FAIL_ROBOT_ON_TOO_MANY_ERRORS = True From 5a0a3788ca048758f16fb493ff14523744f66c59 Mon Sep 17 00:00:00 2001 From: Jakob Duus Terkelsen <36190025+jduust@users.noreply.github.com> Date: Wed, 12 Feb 2025 12:50:11 +0100 Subject: [PATCH 2/3] implementing for loop for retrying queue element in process --- robot_framework/queue_framework.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/robot_framework/queue_framework.py b/robot_framework/queue_framework.py index 57e3850..dc6c884 100644 --- a/robot_framework/queue_framework.py +++ b/robot_framework/queue_framework.py @@ -41,7 +41,17 @@ def main(): break # Break queue loop try: - process.process(orchestrator_connection, queue_element) + for attempt in range(1, config.QUEUE_ATTEMPTS + 1): + try: + process.process(orchestrator_connection, queue_element) + break + except Exception as e: + orchestrator_connection.log_trace(f"Attempt {attempt} failed for current queue element: {e}") + if attempt < config.QUEUE_ATTEMPTS: + orchestrator_connection.log_trace("Retrying queue element.") + else: + orchestrator_connection.log_trace(f"Queue element failed after {attempt} attempts.") + raise orchestrator_connection.set_queue_element_status(queue_element.id, QueueStatus.DONE) except BusinessError as error: From 6db057d89c4f8bc498a47ffeef62708d210ed7dc Mon Sep 17 00:00:00 2001 From: Jakob Duus Terkelsen <36190025+jduust@users.noreply.github.com> Date: Wed, 12 Feb 2025 12:51:32 +0100 Subject: [PATCH 3/3] Added queue_attempts and changed default email to aarhus domain to avoid external sender warning --- robot_framework/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/robot_framework/config.py b/robot_framework/config.py index 6bfc9e7..a762536 100644 --- a/robot_framework/config.py +++ b/robot_framework/config.py @@ -12,7 +12,7 @@ # Error screenshot config SMTP_SERVER = "smtp.adm.aarhuskommune.dk" SMTP_PORT = 25 -SCREENSHOT_SENDER = "robot@friend.dk" +SCREENSHOT_SENDER = "robot@aarhus.dk" # Constant/Credential names ERROR_EMAIL = "Error Email"