Dominick Olivito
10/23/2024, 7:01 PMMarvin
10/23/2024, 7:02 PMDominick Olivito
10/23/2024, 7:03 PMMarvin
10/23/2024, 7:04 PMpython
from prefect import task
import time
@task(timeout_seconds=60, log_prints=True) # Timeout after 60 seconds
def my_task():
print("Task is running")
time.sleep(120) # Simulating a long task
print("Task completed") # This line won't execute if timeout is reached
By setting a timeout, you ensure that tasks do not run longer than intended and can help in managing cases where tasks hang due to unforeseen issues. However, while this won't directly resolve the issue of logs not being sent to Prefect Cloud, it will help in mitigating scenarios where tasks are stuck without completing.
For more detailed information, you can refer to the Prefect documentation on task timeouts.Dominick Olivito
10/23/2024, 7:06 PMMarvin
10/23/2024, 7:06 PMDominick Olivito
10/23/2024, 7:06 PMMarvin
10/23/2024, 7:06 PMDominick Olivito
10/23/2024, 7:08 PMMarvin
10/23/2024, 7:08 PMDominick Olivito
10/23/2024, 7:09 PMMarvin
10/23/2024, 7:09 PM