<@ULVA73B9P> in prefect 2.0, is there a Prefect en...
# ask-marvin
h
@Marvin in prefect 2.0, is there a Prefect env var to set default flow timeout?
m
There seems to be no direct reference to an environment variable that sets a default flow timeout in Prefect 2.0 from the documentation or issues. However, you can define timeouts at the flow or task level programmatically. To set a timeout for a flow, you can use the
timeout_seconds
attribute in the
@flow
decorator. Here's an example:
Copy code
python
from prefect import flow, task

@task
def say_hello():
    print("Hello, World!")

@flow(timeout_seconds=600)  # 10 minutes timeout
def my_flow():
    say_hello()

my_flow()
For setting this as an environment variable, there's no out-of-the-box solution in Prefect 2.0. You would need to manage timeouts within your code explicitly. For more on this, you can refer to the official documentation and specific sections related to flows and tasks. If you require further assistance or a different solution, you can explore Prefect's GitHub issues.