Hi Prefect! :slightly_smiling_face: I'm updating m...
# prefect-community
e
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
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
thanks! 🙂 I would check the subtask docs for now
a
e
oooh I see, nice feature! Thanks a lot Anna 🙂
🙌 1
c
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
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
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...
🙏 1
👍 1