<@ULVA73B9P> I have a flow that I want scheduled f...
# marvin-in-the-wild
c
@Marvin I have a flow that I want scheduled for different times in a day. How can I setup this configuration?
m
To schedule a Prefect flow for different times in a day, you can utilize the multiple schedules feature in Prefect. ### Prefect 2.x With Prefect 2.x, you can assign multiple schedules to deployments. This can be done via the Prefect UI, CLI, Deployment class, or block-based deployment YAML files. For more details, you can refer to the Prefect 2.x documentation on schedules. ### Prefect 3.x In Prefect 3.x, scheduling is also supported. You can define multiple schedules programmatically using methods like
serve
for flow-based deployments or
deploy
for work pool-based deployments. You can also set up schedules via the interactive
prefect deploy
command or by specifying schedules in a
prefect.yaml
file. Check out the Prefect 3.x documentation on adding schedules. To define different times for your flow to run, you can use cron schedules, interval schedules, or more complex rule-based schedules. Here’s an example on how you might define schedules: #### Using the CLI
Copy code
shell
prefect deployment schedule create my-flow --cron "0 9 * * *" --name "Morning Run"
prefect deployment schedule create my-flow --cron "0 17 * * *" --name "Evening Run"
#### Using a YAML configuration
Copy code
yaml
deployments:
- name: my-flow-deployment
  schedules:
  - cron: "0 9 * * *"
    timezone: America/New_York
  - cron: "0 17 * * *"
    timezone: America/New_York
For detailed setup, visit the Prefect scheduling documentation specific to your version linked above. If you need further assistance, feel free to ask!