예제 #1
0
 def on_event_time(self,
                   time: int,
                   window: TimeWindow,
                   ctx: 'Trigger.TriggerContext') -> TriggerResult:
     if time >= window.max_timestamp():
         return TriggerResult.FIRE_AND_PURGE
     else:
         return TriggerResult.CONTINUE
예제 #2
0
 def merge_windows(self,
                   windows,
                   callback: 'MergingWindowAssigner.MergeCallback[TimeWindow]') -> None:
     window_list = [w for w in windows]
     window_list.sort()
     for i in range(1, len(window_list)):
         if window_list[i - 1].end > window_list[i].start:
             callback.merge([window_list[i - 1], window_list[i]],
                            TimeWindow(window_list[i - 1].start, window_list[i].end))
예제 #3
0
 def assign_windows(self, element: tuple, timestamp: int, context):
     return [TimeWindow(timestamp, timestamp + 5)]
예제 #4
0
 def to_internal(self, value) -> TimeWindow:
     return TimeWindow(value.getStart(), value.getEnd())