<@ULVA73B9P> will a time-out flow continue the res...
# ask-marvin
y
@Marvin will a time-out flow continue the rest of the task(slow downloading due to network speed) or exited?
m
thought for 139.2 seconds
Short answer: usually it exits/fails, but not always immediately. In Prefect 3.x, when a flow timeout is reached: - the flow run is marked TimedOut / Failed - Prefect raises a timeout error - but a currently running blocking operation may not stop instantly So for your example of a slow download due to network speed: - if the code is async and waiting at an
await
, it should stop around the timeout - if the code is sync and doing a blocking network call, it may keep running until that call returns or errors, then Prefect exits the flow - it generally will not continue to the rest of the flow normally after the timeout; it will fail once control returns to Prefect Example idea:
Copy code
python
from prefect import flow, task
import requests

@task
def download():
    requests.get("<https://example.com/large-file>")  # blocking call

@flow(timeout_seconds=10)
def my_flow():
    download()
    print("next step")
If
download()
blocks for 60 seconds: - the flow timeout hits at 10 seconds - but the
requests.get(...)
call may not stop immediately - once that blocking call finishes, Prefect will raise the timeout and the flow will fail -
next step
likely will not run Best practice: also set a timeout on the network call itself, not just the flow.
Copy code
python
requests.get("<https://example.com/large-file>", timeout=10)
If you want, I can show you the best pattern for task-level download timeouts + retries in Prefect.