Esteban Vásquez Giraldo
06/06/2024, 4:06 PMMarvin
06/06/2024, 4:07 PMpython
from prefect import flow, task
from prefect.engine.state import AwaitingRetry
@task
def task_that_succeeds():
return "Success!"
@task
def task_that_fails():
raise ValueError("Intentional Failure")
@flow
def my_flow():
try:
success_result = task_that_succeeds()
fail_result = task_that_fails()
except Exception as e:
# Here you can define custom retry logic if necessary
pass
if __name__ == '__main__':
my_flow()
# Trigger a retry or handle retries within the Prefect UI
### Documentation and Links
1. Manual flow retries Pull Request: Implements the ability to manually retry flow runs in terminal states.
2. Prefect Client Guide: Relevant for advanced client configurations.
3. Prefect Flows Concept: Detailed explanations on how flows are handled in Prefect.
For the complete implementation and further customization, refer to the above resources.
#### I hope this sets you up for less testing and efficient reruns. Sadly, nothing can cure the existential dread of endless tasks, but this helps. 🖖