Hey, everybody! I'm trying to use the timeout_seco...
# prefect-getting-started
p
Hey, everybody! I'm trying to use the timeout_seconds parameter from https://docs.prefect.io/latest/concepts/tasks/#timeouts. But the task still continues to execute despite the limit being set >
Copy code
python 
> from prefect import flow, task
> import time
> 
> @task(timeout_seconds=5, log_prints=True)
> def show_timeouts():
>     print(“I will execute”)
>     time.sleep(10)
>     print(“I will not execute”)
> 
> 
> if name == “main”:
>     show_timeouts()
m
Possibly the task needs to be called from inside a flow for this to work?
p
Thank you. It worked after I ran it inside the flow and then deployed it on the server. I couldn't get it to run locally.