Skip to content

Commit 76aff43

Browse files
committed
remove BaseNode
1 parent 6336f43 commit 76aff43

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

sqlmesh/core/scheduler.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22
from dataclasses import dataclass
3+
import abc
34
import logging
45
import typing as t
56
import time
@@ -57,23 +58,23 @@
5758
SnapshotToIntervals = t.Dict[Snapshot, Intervals]
5859

5960

60-
class BaseNode:
61+
class SchedulingUnit(abc.ABC):
6162
snapshot_name: str
6263

63-
def __lt__(self, other: BaseNode) -> bool:
64+
def __lt__(self, other: SchedulingUnit) -> bool:
6465
return (self.__class__.__name__, self.snapshot_name) < (
6566
other.__class__.__name__,
6667
other.snapshot_name,
6768
)
6869

6970

7071
@dataclass(frozen=True)
71-
class EvaluateNode(BaseNode):
72+
class EvaluateNode(SchedulingUnit):
7273
snapshot_name: str
7374
interval: Interval
7475
batch_index: int
7576

76-
def __lt__(self, other: BaseNode) -> bool:
77+
def __lt__(self, other: SchedulingUnit) -> bool:
7778
if not isinstance(other, EvaluateNode):
7879
return super().__lt__(other)
7980
return (self.__class__.__name__, self.snapshot_name, self.interval, self.batch_index) < (
@@ -85,18 +86,15 @@ def __lt__(self, other: BaseNode) -> bool:
8586

8687

8788
@dataclass(frozen=True)
88-
class CreateNode(BaseNode):
89+
class CreateNode(SchedulingUnit):
8990
snapshot_name: str
9091

9192

9293
@dataclass(frozen=True)
93-
class DummyNode(BaseNode):
94+
class DummyNode(SchedulingUnit):
9495
snapshot_name: str
9596

9697

97-
SchedulingUnit = t.Union[EvaluateNode, CreateNode, DummyNode]
98-
99-
10098
class Scheduler:
10199
"""Schedules and manages the evaluation of snapshots.
102100

0 commit comments

Comments
 (0)