Skip to content

Commit bb59c97

Browse files
authored
Fix: calculate when next model ready to run correctly (#3612)
1 parent 3bd0d5f commit bb59c97

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

sqlmesh/core/snapshot/definition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,7 @@ def get_next_model_interval_start(snapshots: t.Iterable[Snapshot]) -> datetime:
20992099
now_dt = now()
21002100
return min(
21012101
[
2102-
snap.node.interval_unit.cron_next(now_dt)
2102+
snap.node.cron_next(now_dt)
21032103
for snap in snapshots
21042104
if snap.is_model and not snap.is_symbolic and not snap.is_seed
21052105
]

tests/core/test_snapshot.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,11 @@ def test_add_interval_partial(snapshot: Snapshot, make_snapshot):
271271
def test_get_next_model_interval_start(make_snapshot):
272272
hourly_snapshot = make_snapshot(
273273
SqlModel(
274-
name="late", kind=FullKind(), query=parse_one("SELECT 1, ds FROM name"), cron="@hourly"
274+
name="late",
275+
kind=FullKind(),
276+
query=parse_one("SELECT 1, ds FROM name"),
277+
cron="@hourly",
278+
interval_unit=IntervalUnit.HALF_HOUR,
275279
)
276280
)
277281

0 commit comments

Comments
 (0)