<@ULVA73B9P> how can i submit a subflow 4 minutes ...
# ask-marvin
d
@Marvin how can i submit a subflow 4 minutes from the submission epoch?
m
To submit a subflow to run 4 minutes from the submission epoch, you'll want to use the
schedule
parameter in your Prefect flow. Here's an example of how you can achieve this:
Copy code
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!