Hi all – are there any known issues with Cron cloc...
# ask-community
s
Hi all – are there any known issues with Cron clocks? I'm having some difficulty with porting a job out of our old scheduling tool that my team uses to a new one. We have a job that runs every day, every 8 hours starting at 7am. In moving this job to prefect and setting the flow schedule, I'm using a cron schedule that seems to me like it should achieve what I want, and the Prefect UI tells my in plain english that the flow's schedule is correct (within the flow's Overview pane), but then when I look at the scheduled upcoming flows, it doesn't seem to match.
So, for example, I'm using this for my Cron clock:
Copy code
CronClock(
    cron="0 0 7/8 * * *",
start_date=pendulum.datetime(
        2021, 7, 1, 0, 0, 0, tz="America/New_York"
    ),
)
and the "Overview" pane in the Cloud UI says:
Copy code
At 0 minutes past the hour, every 8 hours, starting at 07:00 AM (EDT)
which is indeed correct, but then when I look at the upcoming scheduled flow runs, I'm seeing this:
j
Hi @Sean Talia - let me see take a few minutes to look into this for you.
s
ok thanks @Jenny!
k
Hey @Sean Talia, this looks right. Did you have an old schedule? Did you try toggling the schedule bar?
s
yeah I had an old one that was missing a leading 0 (so it was being scheduled for every 8 minutes 7 minutes past the hour every hour) but then i reregistered with this new one, let me try toggling
it doesn't seem to be helping – maybe I should just try deleting the flow and reregistering it?
j
Hi @Sean Talia - do you have any schedules set for the flow in the UI? (I.e. through the settings tab on the flow page.)
s
It looks like it! Also seems good to me there?
j
Yep that looks right. I have an idea that something in the UI might be adding the timezone twice in the upcoming runs tile. Let me check that and get back to you.
s
One of the things I've had to play around with is the fact that the cron syntax we use in our old tool (Rundeck) is slightly different from what Prefect / croniter expects, so my old crontab was
0 0 7/8 ? * * *
which isn't valid w/ croniter apparently, but I'm pretty sure the new syntax I'm using without the
?
special character is what I want
oh interesting okay
j
@Sean Talia - Sorry I don't think it is the UI. But a difference in cron clocks. Can you try:
Copy code
CronClock(
    cron="0 7/8 * * *",
start_date=pendulum.datetime(
        2021, 7, 1, 0, 0, 0, tz="America/New_York"
    ),
)])
s
I think that's what I originally had, I'll take a screenshot once I re-register
j
Note it's one zero at the beginning instead of two
s
Okay this worked! Sorry that I didn't try this permutation – the problem with my original schedule was that I had 4 `*`'s; so 1.
0 7/8 * * * *
(bad, I know why) 2.
0 0 7/8 * * *
(bad, although the schedule seemed okay when it was spelled out in plain English) 3.
0 7/8 * * *
good
j
Great! Glad it worked.
s
So is there then a bug with whatever generates that statement "At 0 minutes past the hour, every 8 hours, starting at 07:00 AM (EDT)"? That seems to have been identical for both
0 0 7/8 * * *
and
0 7/8 * * *
?
or maybe it's still true in the latter case but there's more information that's not being displayed?
j
Good question! It had me confused for a while too. I’m going to put a ticket in to check.
@Marvin open “Misleading schedule information” in UI