Maikel Penz
11/07/2019, 3:13 AMtask retries
. Shouldn't the code below retry
only every 30 seconds ?
When I run it the output goes from 1 to 40 in less than a second and finishes. I expected it would take 30(seconds) x 40 runs to finish (as per my if loop_count == 40:
to stop)
from prefect import Flow, task, context
from prefect.engine.signals import LOOP
import datetime
import time
@task(max_retries=50, retry_delay=datetime.timedelta(seconds=30))
def test_retry():
loop_count = context.get("task_loop_count", {})
print(loop_count)
if loop_count == 40:
return "finished"
raise LOOP(message="Next run")
with Flow("test-pipeline") as flow:
test_retry()
flow.run()
Chris White
11/07/2019, 3:18 AMMaikel Penz
11/07/2019, 3:19 AMraise LOOP(message="Next run")
would force the next retryChris White
11/07/2019, 3:21 AMSUCCESS
signal, which forceably transitions the task to a Success
stateMaikel Penz
11/07/2019, 3:23 AMChris White
11/07/2019, 3:23 AM