Hey everyone, I noticed that in Prefect cloud my d...
# prefect-cloud
j
Hey everyone, I noticed that in Prefect cloud my deployment has the correct schedule I intended for but then noticed that the flow runs are executing at different times
We created this using
prefect.flows.deploy
from the Python SDK, and I am passing in
cron
for the schedule, but I assume that I also need to pass in
schedule
to specify the timezone?
k
you can provide a time zone on your deployment schedule, yeah. I haven't confirmed this yet but I think if all you're passing in is a cron expression it'd use UTC as the time zone
j
Cool, is there an example on using
schedules
to pass a timezone in using the SDK?
This is the description using that parameter
schedules	Optional[List[MinimalDeploymentSchedule]]	A list of schedule objects defining when to execute runs of this deployment. Used to define multiple schedules or additional scheduling options like timezone.
k
yep I was just typing that up
Copy code
from prefect import flow, get_run_logger
from prefect.client.schemas.schedules import CronSchedule

@flow
def parent():
    get_run_logger().info("Starting parent flow")

if __name__ == "__main__":
    parent.deploy(
        schedules=[CronSchedule(cron="0 0 * * *", timezone="America/New_York")]
    )
j
Sweet, thanks!