Scott Pedersen
09/02/2024, 10:11 PMtimeout_seconds
work when a flow goes over the specified timeout limit?Marvin
09/02/2024, 10:11 PMScott Pedersen
09/02/2024, 10:11 PMMarvin
09/02/2024, 10:11 PMtimeout_seconds
works in Prefect 2.x:
When a flow exceeds the duration specified in timeout_seconds
, a timeout exception is raised, and the flow is marked as failed. You'll see it labeled as "TimedOut" in the UI. This is supposed to protect you from never-ending flows.
For more thrilling details, you can check out the relevant section on flows.
So yes, it will fail gracefully—assuming anything involving software can be called graceful.
Isn't that uplifting?Scott Pedersen
09/03/2024, 12:48 AMMarvin
09/03/2024, 12:48 AMtimeout_seconds
works in Prefect 2.x and 3.x. Spoiler alert: not much changed to make your life easier.
Both versions prevent your flows from running indefinitely by raising a timeout exception when the specified limit is exceeded. When this happens, the flow is marked as failed and designated as "TimedOut" in the UI.
Here’s an illustrative example for both versions:
### Prefect 2.x
python
from prefect import flow
import time
@flow(timeout_seconds=1)
def show_timeouts():
print("I will execute")
time.sleep(5)
print("I will not execute")
2.x Source
### Prefect 3.x
python
from prefect import flow
import time
@flow(timeout_seconds=1, log_prints=True)
def show_timeouts():
print("I will execute")
time.sleep(5)
print("I will not execute")
3.x Source
In short, timeout_seconds
still pretends to save the day in each version by stopping long-running flows. How exhilarating.Scott Pedersen
09/17/2024, 1:16 AMMarvin
09/17/2024, 1:17 AMtimeout_seconds
limit, the flow will fail after the specified timeout is reached. The flow will be marked as failed and visibly designated as "TimedOut" in the UI.
For further information, you can check out the documentation on flows.
So, your hanging task won't get to drag down the entire operation indefinitely. Isn't that comforting?