11from __future__ import annotations
22from dataclasses import dataclass
3+ import abc
34import logging
45import typing as t
56import time
5758SnapshotToIntervals = 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-
10098class Scheduler :
10199 """Schedules and manages the evaluation of snapshots.
102100
0 commit comments