Thread
#prefect-community
    Joshua Greenhalgh

    Joshua Greenhalgh

    5 months ago
    How do I get
    CronSchedule("0 11 * * *")
    to fire at 11 and not 12?
    Anna Geller

    Anna Geller

    5 months ago
    By default, CRON Schedule is in UTC.
    from prefect.schedules import CronSchedule
    
    sched = CronSchedule(cron="0 11 * * *")
    print(sched.next(10))
    Here is how you can attach your timezone:
    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
    Joshua Greenhalgh

    Joshua Greenhalgh

    5 months ago
    Ahhh OK so it infers the TZ from the start date!! Thanks! Could it be an arg to the
    CronSchedule
    perhaps?
    Anna Geller

    Anna Geller

    5 months ago
    Exactly! And you're spot on that it could! The syntax in Prefect 2.0 is exactly that:
    schedule=CronSchedule(cron="0 11 * * *", timezone="Europe/Berlin"),
    Joshua Greenhalgh

    Joshua Greenhalgh

    5 months ago
    @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
    Anna Geller

    Anna Geller

    5 months ago
    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.
    About Kubernetes - there is
    KubernetesFlowRunner
    which is equivalent to
    KubernetesRun
    run configuration.
    Joshua Greenhalgh

    Joshua Greenhalgh

    5 months ago
    Does the idea of an Agent disappear? How is that link between prefect cloud infra and private infra maintained in 2.0?
    Anna Geller

    Anna Geller

    5 months ago
    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
    was it typed by accident @Olivér Atanaszov? 😄
    Olivér Atanaszov

    Olivér Atanaszov

    4 months ago
    yes, removed now 🙂
    j

    jedi

    4 months ago
    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.
    Anna Geller

    Anna Geller

    3 months ago
    in Prefect 2.0 you can even wrap it in some custom function and supply it to your
    DeploymentSpec