Esempio n. 1
0
 def from_runner_api(proto, context):
   # pylint: disable=wrong-import-order, wrong-import-position
   from apache_beam.transforms.trigger import TriggerFn
   return Windowing(
       windowfn=WindowFn.from_runner_api(proto.window_fn, context),
       triggerfn=TriggerFn.from_runner_api(proto.trigger, context),
       accumulation_mode=proto.accumulation_mode,
       output_time_fn=proto.output_time)
Esempio n. 2
0
 def test_trigger_encoding(self):
   for trigger_fn in (
       DefaultTrigger(),
       AfterAll(AfterCount(1), AfterCount(10)),
       AfterAny(AfterCount(10), AfterCount(100)),
       AfterWatermark(early=AfterCount(1000)),
       AfterWatermark(early=AfterCount(1000), late=AfterCount(1)),
       Repeatedly(AfterCount(100)),
       trigger.OrFinally(AfterCount(3), AfterCount(10))):
     context = pipeline_context.PipelineContext()
     self.assertEqual(
         trigger_fn,
         TriggerFn.from_runner_api(trigger_fn.to_runner_api(context), context))
Esempio n. 3
0
 def test_trigger_encoding(self):
     for trigger_fn in (DefaultTrigger(),
                        AfterAll(AfterCount(1), AfterCount(10)),
                        AfterAny(AfterCount(10), AfterCount(100)),
                        AfterWatermark(early=AfterCount(1000)),
                        AfterWatermark(early=AfterCount(1000),
                                       late=AfterCount(1)),
                        Repeatedly(AfterCount(100)),
                        trigger.OrFinally(AfterCount(3), AfterCount(10))):
         context = pipeline_context.PipelineContext()
         self.assertEqual(
             trigger_fn,
             TriggerFn.from_runner_api(trigger_fn.to_runner_api(context),
                                       context))