Kaleb King
06/21/2024, 4:30 AMprefect.yaml file, how do I specify a cron schedule of 0 6-18 * * 1-5?Marvin
06/21/2024, 4:30 AMprefect.yaml file, you can follow the example below. This example will schedule your task to run at every hour from 06:00 to 18:00 (inclusive) on weekdays (Monday to Friday).
yaml
deployments:
- name: your-deployment-name
schedules:
- cron: "0 6-18 * * 1-5"
timezone: "UTC" # You can change the timezone as needed
active: true
Be sure to fill in your-deployment-name with the actual name of your deployment.
For more detailed information, you can refer to the Prefect documentation on schedules. Here's a brief example from the documentation:
yaml
deployments:
...
schedules:
- cron: "0 0 * * *"
timezone: "America/Chicago"
active: false
- cron: "0 12 * * *"
timezone: "America/New_York"
active: true
- cron: "0 18 * * *"
timezone: "Europe/London"
active: true
This should get you started with scheduling using cron in your prefect.yaml file.Kaleb King
06/21/2024, 4:41 AM.yaml file?Marvin
06/21/2024, 4:41 AMprefect.yaml file, follow these steps:
1. Ensure you have your prefect.yaml file ready with the deployment configuration, including schedules, like the example below:
yaml
deployments:
- name: your-deployment-name
schedules:
- cron: "0 6-18 * * 1-5"
timezone: "UTC"
active: true
2. Navigate to the directory containing your prefect.yaml file. You can also initialize your deployment configuration using the CLI command prefect init if you need to create a new prefect.yaml file.
3. Run the Prefect deployment command to create deployments as specified in the prefect.yaml file. Use the following command:
sh
prefect deploy -n your-deployment-name
This command will create the deployment based on the information in the prefect.yaml file.
For further details, you can refer to the Prefect deployment guide.
If the prefect.yaml file is not in the root of your repository, ensure you provide the correct path to it:
sh
prefect deploy -n your-deployment-name -p /path/to/your/prefect.yaml
This should create your deployment successfully.