Skip to content

Commit

Permalink
FIX: Avoid retrying once if retry prevented in Child.ask
Browse files Browse the repository at this point in the history
  • Loading branch information
cortadocodes committed Jul 23, 2024
1 parent 3398885 commit ffeb271
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion octue/resources/child.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def ask(
:param float|int maximum_heartbeat_interval: the maximum amount of time (in seconds) allowed between child heartbeats before an error is raised
:raise TimeoutError: if the timeout is exceeded while waiting for an answer
:raise Exception: if the question raises an error and `raise_errors=True`
:return dict|octue.cloud.pub_sub.subscription.Subscription|Exception|None, str: for a synchronous question, a dictionary containing the keys "output_values" and "output_manifest" from the result, and the question UUID; for a question with a push endpoint, the push subscription and the question UUID; for an asynchronous question, `None` and the question UUID
:return dict|octue.cloud.pub_sub.subscription.Subscription|Exception|None, str: for a synchronous question, a dictionary containing the keys "output_values" and "output_manifest" from the result (or just an exception if the question fails), and the question UUID; for a question with a push endpoint, the push subscription and the question UUID; for an asynchronous question, `None` and the question UUID
"""
prevent_retries_when = prevent_retries_when or []

Expand Down Expand Up @@ -153,6 +153,9 @@ def ask(
if raise_errors:
raise e

if type(e) in prevent_retries_when:
return e, question_uuid

for retry in range(max_retries):
logger.info("Retrying question %r %d of %d times.", question_uuid, retry + 1, max_retries)

Expand Down

0 comments on commit ffeb271

Please sign in to comment.