https://prefect.io logo
Title
e

Enrique

08/29/2022, 9:20 AM
Hi Prefect! 🙂 I'm updating my flows from 1.X to 2.X. Is there a way to set a task timeout as we had in the previous versions? thanks a lot!
1
a

Anna Geller

08/29/2022, 11:07 AM
You can currently set
timeout_seconds
on your flow decorator, so if you convert this task to a subflow, you can already solve the issue this way. Setting timeout on a task is a reasonable request - let's open an issue to investigate whether we can add that - I believe this would be hard to do with async and various distributed task runners like Dask or Ray, but Michael can estimate that best - you can follow up on the issue. Thanks for bringing this up and until then you can set a timeout on a subflow @Marvin open "Consider adding
timeout
to the task decorator"
e

Enrique

08/29/2022, 12:37 PM
thanks! 🙂 I would check the subtask docs for now
a

Anna Geller

08/29/2022, 1:52 PM
e

Enrique

08/29/2022, 2:27 PM
oooh I see, nice feature! Thanks a lot Anna 🙂
🙌 1
c

Chris L.

09/16/2022, 3:54 AM
Hi @Anna Geller would you happen know what the default task timeout is? I see this
timeout
kwarg in the
BaseTaskRunner
. But can't figure out where the timeout is being set? (https://github.com/PrefectHQ/prefect/blob/269e3678d03b820429f5e090a740b3d5e57058d9/src/prefect/task_runners.py#L132) Wondering if this config can be changed globally? I have some long running tasks on Dask and it's timing out prematurely. Many thanks!
One issue I see with the
future.result(timeout=s)
suggestion is it is (to my knowledge) a blocking operation in Dask (https://docs.dask.org/en/stable/futures.html#submit-tasks). I could use the
client.gather
pattern with futures but it seems much easier to just configure timeout for all tasks.
a

Anna Geller

09/16/2022, 11:25 AM
I'd encourage you to add any additional findings directly to the GitHub issue https://github.com/PrefectHQ/prefect/issues/6600 this way, engineers who know this well can answer and see how we can add timeout. Thanks in advance, Chris!
c

Chris L.

09/17/2022, 11:11 AM
Thanks Anna! I'll try to create a MVRE for this, but it'll take some time as the behavior seems to differ across execution environments...
:thank-you: 1
👍 1