https://prefect.io logo
Title
n

Naila Chennit

12/30/2022, 10:01 AM
Hi Prefect team I am trying to handle tasks timout, and was wondering how can I stop/cancel a task if the timout is reached FYI: I am using Prefect 2.3.1 Here is an exemple of what I want to do
Wait N sconds for the task to complete

        >>> @flow
        >>> def my_flow():
        >>>     future = my_task()
        >>>     final_state = future.wait(0.1)
        >>>     if final_state:
        >>>         ... # Task done
        >>>     else:
        >>>         ... # Task not done yet = > Cancel task
1
c

Christopher Boyd

12/30/2022, 1:22 PM
H Naila, Is this what you are looking for? https://docs.prefect.io/concepts/tasks/#timeouts
n

Naila Chennit

12/30/2022, 1:27 PM
Hi Christopher yes i'm looking for this , but in the version that i'm using (2.3.1) the
timeout_seconds
argument doesn't exist, which version is this please ?
c

Christopher Boyd

12/30/2022, 1:29 PM
For bug fixes and stability, we generally recommend the latest (which is 2.7.5), unless you have a reason to use a specific older version
n

Naila Chennit

12/30/2022, 1:30 PM
okay , i'll give it a try, thank you 🙂