Hi, is there a way to have task timeouts - to mark...
# prefect-community
s
Hi, is there a way to have task timeouts - to mark the task as failed if it runs too long (and then execute some code to stop it, for example)? In my case I can code that into the task itself, but it would be nice if there was some built-in mechanism.
n
Hi @Saulius Beinorius - the task constructor takes a kwarg
timeout
, to which you can pass a number (in seconds) to wait before timing out the task. For more information on the
timeout
kwarg and other task kwargs, take a look at the Task API.
s
Thanks! And if I see correctly, the
on_failure
parameter answer the second part of my question 🙂
n
Ah yes sorry! I missed the question in the parenthesis 🙂
s
No problem, thanks for the help!
😄 1