Repository navigation
fix(scheduler): don't process unfinished intervals for crons with an hour range - #6320
Naman-Gururani wants to merge 1 commit into
Conversation
…hour range For a cron like `0 9-17 * * *`, `cron_floor` could return a time in the future outside of the cron's hours, because it estimated the previous tick. The run then marked an interval that hadn't ended as complete, and the rows that arrived later were never loaded. Signed-off-by: Naman Gururani <gururaninaman@gmail.com>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Description
Models with a cron like
0 9-17 * * *can silently lose rows.Outside of the cron's hours,
cron_floorcan return a time in the future:So a
sqlmesh runin the evening processes an interval that hasn't ended and marks it as complete. The rows that arrive later in that interval are never loaded, and there's no error. In my DuckDB test the model ended up with 386 of 390 rows.cron_flooralways calledget_prev(estimate=True), even though its own default isestimate=False. The estimate uses the gap between the next few ticks, which looks hourly here. Now it passes on its ownestimateargument.Each
cron_floorcall gets slower, from about 55 to 107 µs for@hourlyon my machine.Test Plan
test_missing_intervals_cron_with_hour_range. It fails onmain.tests/core,tests/schedulersandtests/utilsonmainand on this branch. Both runs hang near the end on my Windows machine, intest_context.py. The 2,511 tests that finished in both runs had the same results.Checklist
make styleand fixed any issues (I ran ruff on the two files)make fast-test) (see the test plan)git commit -s) per the DCO