PrefectHQ / prefect

Prefect is a workflow orchestration framework for building resilient data pipelines in Python.
https://prefect.io
Apache License 2.0
15.33k stars 1.5k forks source link

Next run's "scheduled for" time doesn't match the "Schedules" time #13591

Open mitchnielsen opened 1 month ago

mitchnielsen commented 1 month ago

First check

Bug summary

The time mentioned under "Next run" doesn't match with the time mentioned under "Schedules":

This is with my timezone set to America/Chicago under Preferences.

Reproduction

  1. Create a work pool:
prefect work-pool create my-managed-pool --type prefect:managed
  1. Create a scheduled Deployment:
# create_deployment.py
from prefect import flow

if __name__ == "__main__":
    flow.from_source(
        source="https://github.com/prefecthq/demos.git",
        entrypoint="my_gh_workflow.py:repo_info",
    ).deploy(
        name="my-first-deployment",
        work_pool_name="my-managed-pool",
        cron="0 1 * * *",
    )
python create_deployment.py
  1. Observe the times listed on the Deployment page.

Error

Note that the "Next Run" section reports 8:00 PM, while the "Schedules" section reports 1:00 PM:

image

Browsers

Prefect version

No response

Additional context

Created from experience running through the Quickstart guide (https://github.com/PrefectHQ/prefect/pull/13562).

I'm still new to Prefect so it's very possible that this is either known or requires a setting I haven't set yet :)

aaazzam commented 1 month ago

Almost a timezone issue 😂 -- you're in midwest, no?

This needs to be fixed either way, but my suspicion was that a cron string sans timezone anchors to UTC whereas the UI anchors to your local TZ. So that 5 hour difference would "make sense" if you were in EST at time of authoring.

mitchnielsen commented 1 month ago

Yup! Kansas City, set to America/Chicago in Preferences.

a cron string sans timezone anchors to UTC

Mm, makes sense - I don't see a way at the moment to pass a timezone in flow.deploy(), but yeah, maybe we can eventually get the UI to align them based on the timezone set in Preferences.