David
08/20/2024, 6:45 PMMarvin
08/20/2024, 6:46 PMschedule
parameter in your Prefect flow. Here's an example of how you can achieve this:
python
from datetime import timedelta
from prefect import flow, task
from prefect.orion.schemas.schedules import IntervalSchedule
@task
def greet():
print("Hello from the subflow!")
@flow
def subflow():
greet()
@flow(schedule=IntervalSchedule(interval=timedelta(minutes=4)))
def main_flow():
future = subflow.submit()
future.wait()
if __name__ == "__main__":
main_flow()
This example uses an IntervalSchedule
to schedule the subflow to run at an interval, but since intervals begin counting from the flow's start time, it essentially waits 4 minutes before running.
For more information, have a look at the related Prefect documentation on Flow schedules.
If you need detailed examples, you can check this example here.
Happy automating!Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by