Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion robot_framework/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
# 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

# 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"
Expand Down
12 changes: 11 additions & 1 deletion robot_framework/queue_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading