View in #prefect-community on Slack
@Michael_Smith: Hello, my prefect 2.0 tests are going well…I see that Flow has a timeout_seconds parameter, is there any way to set Task level timeouts as well?
@Kevin_Kho: Orion doesn’t have timeouts yet so I don’t think there is a simple way like in Prefect 1
@Michael_Adkins: We don’t support cancellation of tasks at this time, but you can perform logic based on a wait/timeout
future = my_task(arg, arg)
state = future.wait(5)
if not state:
# Do something based on this timeout
...
Here’s the example from the docstring
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