https://prefect.io logo
Title
m

Matias Godoy

04/20/2020, 3:27 PM
Hi guys! I have a question about task options; can I combine the
retries
option with the
timeout
? Let me explain better: Inside my task I am polling an API waiting for something to finish. If one of those HTTP calls fail, I'd like to retry, but if it takes too long and that something hasn't finished, I want the entire task to timeout. Is that how combining those two options work? I'm afraid that a timeout would cause a retry and start all over again.
k

Kyle Moon-Wright

04/20/2020, 4:23 PM
Hey Matias, Yes, a timed out task will trigger a retry. The task will wait the indicated time (in seconds) while running a task before the timeout occurs. Alternatively, an advanced technique would be to create a custom timeout handler by importing
timeout_handler
from
prefect.utilities.executors
.
m

Matias Godoy

04/21/2020, 8:40 AM
Oh, that is nice! Thanks a lot for your answer :)
c

Chris White

04/21/2020, 5:06 PM
@Marvin archive “Using Retries and Timeouts together”