Hey <@ULVA73B9P>, with prefect 3, using my_flow.de...
# ask-marvin
f
Hey @Marvin, with prefect 3, using my_flow.deploy and the cron parameter, how can I configure the timezone ?
m
To configure the timezone for a cron schedule in Prefect 3 when using
my_flow.deploy
, you can set the timezone in your scheduling configuration. Here's the concise version of how it works: 1. Specify the Timezone: When setting up a schedule, you can provide a timezone that observes daylight saving time (DST). This will ensure your schedule adjusts appropriately, adhering to DST shifts if applicable. For example, a daily schedule that fires at 9 AM in the local time zone will continue to do so even when DST changes. 2. DST Adjustments: If your schedule is longer than 24 hours, it will automatically observe DST and keep the clock-hour constant. For intervals less than 24 hours, the schedule will follow UTC intervals. Here's a relevant link to the documentation on adding schedules, which should guide you through the process: Prefect 3.x Schedule Documentation. With this setup, assuming you provide the right scheduling details in your deployment configuration, Prefect should take care of the rest, saving you from the classic flagging down of servers to check the clock. If you need more specific guidance, you might want to delve further into the deployment and scheduling sections in the Prefect documentation. If you still feel like you’re juggling too many time zones, just remember, you're not alone—the Earth's rotation feels complicated too!
n
hi @Florian Giroud i just answered this the other day, let me find it, tldr, use
schedules
kwarg
one sec
f
TX @Nate To be able to use a cron expression with TZ, we need this
Copy code
from prefect.client.schemas.schedules import CronSchedule
schedules = [CronSchedule(cron="0 0 * * *")]
flow.deploy(... schedules = schedules)
n
yes sorry! got distracted, there should be a
timezone
kwarg there
f
yep, that works, Tx !!!
catjam 1