https://prefect.io logo
#prefect-community
Title
# prefect-community
j

Joshua Greenhalgh

04/25/2022, 10:29 AM
How do I get
CronSchedule("0 11 * * *")
to fire at 11 and not 12?
🙌 1
a

Anna Geller

04/25/2022, 10:58 AM
By default, CRON Schedule is in UTC.
Copy code
from prefect.schedules import CronSchedule

sched = CronSchedule(cron="0 11 * * *")
print(sched.next(10))
Here is how you can attach your timezone:
Copy code
from prefect.schedules import CronSchedule
import pendulum

sched = CronSchedule(
    cron="0 11 * * *",
    start_date=pendulum.datetime(2022, 4, 25, 0, 0, tz="Europe/London"),
)
print(sched.next(10))
Printing the next schedules
sched.next(10)
can help make sure your schedule is configured correctly
j

Joshua Greenhalgh

04/25/2022, 12:05 PM
Ahhh OK so it infers the TZ from the start date!! Thanks! Could it be an arg to the
CronSchedule
perhaps?
a

Anna Geller

04/25/2022, 12:08 PM
Exactly! And you're spot on that it could! The syntax in Prefect 2.0 is exactly that:
Copy code
schedule=CronSchedule(cron="0 11 * * *", timezone="Europe/Berlin"),
🙌 1
j

Joshua Greenhalgh

04/26/2022, 12:03 PM
@Anna Geller on the 2.0 point - how painful is it going to be for me to move to 2.0 given I have built everything out for 1.0 - is there gonna be a nice smooth transition that isn't gonna require huge infra changes?
Or am I gonna end up in a world where I am stuck with 1.0 cos the migration is painful and then all support for 1.0 ends?
The model of k8s and jobs per flow is really not something I want to have to change for example
a

Anna Geller

04/26/2022, 12:10 PM
We'll do our best to support you with migration. There is already a special tag on Discourse called migration-guide, and if you are an existing customer, our CS team provides support, too (cs@prefect.io). And of course, there will be a Migration Guide docs section with more details.
🙌 1
About Kubernetes - there is
KubernetesFlowRunner
which is equivalent to
KubernetesRun
run configuration.
🙌 1
j

Joshua Greenhalgh

04/26/2022, 1:31 PM
Does the idea of an Agent disappear? How is that link between prefect cloud infra and private infra maintained in 2.0?
a

Anna Geller

04/26/2022, 1:57 PM
Agents are still there but they are not tied to a specific infrastructure - e.g. there is no need for a Kubernetes agent. The same agent can deploy flow runs as Docker containers or Kubernetes jobs, depending on your flow runner configuration. Check this Discourse topic for more info
🙌 1
was it typed by accident @Olivér Atanaszov? 😄
o

Olivér Atanaszov

05/04/2022, 10:22 AM
yes, removed now 🙂
👍 1
j

jedi

05/24/2022, 2:59 PM
Is there a way to set Cron Time zone at an agent level like US/Eastern via maybe an environment variable so that I do not have to specify it for every Cron schdule? I guess alternatively, I could wrap CronSchedule using functools to provide additional args to make it EST.
a

Anna Geller

05/30/2022, 10:14 AM
in Prefect 2.0 you can even wrap it in some custom function and supply it to your
DeploymentSpec
49 Views