Hi right now I want to scheldure a task with a Cro...
# prefect-community
n
Hi right now I want to scheldure a task with a CronClock, but right now the default CronClock of Prefect is in UTC. Is there a way to change it to a specific time zone? The code I try right now is as follow but it does not change the start date of the CronClock (terminal still show UTC)
Copy code
from prefect.schedules.clocks import CronClock
import pendulum

schedule = Schedule(clocks=[CronClock("40 14 * * *", start_date=pendulum.now("Asia/Ho_Chi_Minh"))])
a
what version of prefect core are you on? I tried out your example without issue:
Copy code
prefect.schedules.Schedule(
        clocks=[CronClock("17 20 * * *", start_date=pendulum.now("Asia/Ho_Chi_Minh"))]
    )
...
Copy code
[2020-03-06 13:16:30,276] INFO - prefect.Flow: long-sleep | Waiting for next scheduled run
 at 2020-03-06T20:17:00+07:00
[2020-03-06 13:17:00,005] INFO - prefect.FlowRunner | Beginning Flow run for 'long-sleep'
(specifically the start date is the correct timezone of +7 hours offset)
n
hmm im running on 0.9.5 version. Still does not work, the original clock is still in UTC.
I have tried the example code from the documentation
Copy code
import prefect
from prefect import task, Flow
from datetime import timedelta
from prefect.schedules.clocks import CronClock
import pendulum
@task
def say_hello():
    print("Hello, world!")

daily_schedule = prefect.schedules.Schedule(clocks=[CronClock("17 20 * * *", start_date=pendulum.now("Asia/Ho_Chi_Minh"))])

with Flow("Hello", daily_schedule) as flow:
    say_hello()

flow.run()
it returns this while my execute local time is 10:20 AM. So the clock is still UTC
Copy code
[2020-03-10 03:19:33,565] INFO - prefect.Flow: Hello | Waiting for next scheduled run at 2020-03-10T20:17:00+07:00
you can see the screenshot below if you want