Robin
01/15/2025, 11:02 AMRobin
01/15/2025, 1:53 PMMarvin
01/15/2025, 1:53 PMRobin
01/15/2025, 1:54 PMMarvin
01/15/2025, 1:54 PMpython
from prefect import flow, task
from datetime import datetime, timedelta
@task
def evaluate_data(for_date):
# Logic to evaluate data for the given date
pass
@flow
def my_flow(for_date: datetime = None):
if not for_date:
# Infer the date as the previous day if not provided
for_date = datetime.now() - timedelta(days=1)
evaluate_data(for_date)
# Deployment and scheduling logic
# You can define this in a YAML file or using Prefect CLI
Links for Further Reading:
- Prefect Scheduling
- Custom Triggers in Prefect
This approach allows you to have a default behavior for date inference while retaining flexibility for retriggering with a fixed date.Robin
01/15/2025, 1:56 PMKevin Grismore
01/15/2025, 3:06 PMRobin
01/15/2025, 3:09 PMKevin Grismore
01/15/2025, 3:11 PMRobin
01/17/2025, 6:27 PM