예제 #1
0
 def test_timer_coder(self):
   self.check_coder(coders._TimerCoder(coders.BytesCoder()),
                    *[{'timestamp': timestamp.Timestamp(micros=x),
                       'payload': b'xyz'}
                      for x in range(-3, 3)])
   self.check_coder(
       coders.TupleCoder((coders._TimerCoder(coders.VarIntCoder()),)),
       ({'timestamp': timestamp.Timestamp.of(37), 'payload': 389},))
예제 #2
0
 def test_timer_coder(self):
   self.check_coder(coders._TimerCoder(coders.BytesCoder()),
                    *[{'timestamp': timestamp.Timestamp(micros=x),
                       'payload': b'xyz'}
                      for x in (-3000, 0, 3000)])
   self.check_coder(
       coders.TupleCoder((coders._TimerCoder(coders.VarIntCoder()),)),
       ({'timestamp': timestamp.Timestamp.of(37000), 'payload': 389},))
예제 #3
0
파일: userstate.py 프로젝트: mjacoby/beam
 def to_runner_api(self, context):
     # type: (PipelineContext) -> beam_runner_api_pb2.TimerFamilySpec
     return beam_runner_api_pb2.TimerFamilySpec(
         time_domain=TimeDomain.to_runner_api(self.time_domain),
         timer_family_coder_id=context.coders.get_id(
             coders._TimerCoder(coders.StrUtf8Coder(),
                                coders.GlobalWindowCoder())))
예제 #4
0
 def test_timer_coder(self):
     self.check_coder(
         coders._TimerCoder(coders.StrUtf8Coder(),
                            coders.GlobalWindowCoder()),
         *[
             userstate.Timer(user_key="key",
                             dynamic_timer_tag="tag",
                             windows=(GlobalWindow(), ),
                             clear_bit=True,
                             fire_timestamp=None,
                             hold_timestamp=None,
                             paneinfo=None),
             userstate.Timer(user_key="key",
                             dynamic_timer_tag="tag",
                             windows=(GlobalWindow(), ),
                             clear_bit=False,
                             fire_timestamp=timestamp.Timestamp.of(123),
                             hold_timestamp=timestamp.Timestamp.of(456),
                             paneinfo=windowed_value.PANE_INFO_UNKNOWN)
         ])
예제 #5
0
 def to_runner_api(self, context):
     # type: (PipelineContext) -> beam_runner_api_pb2.TimerSpec
     return beam_runner_api_pb2.TimerSpec(
         time_domain=TimeDomain.to_runner_api(self.time_domain),
         timer_coder_id=context.coders.get_id(
             coders._TimerCoder(coders.SingletonCoder(None))))
예제 #6
0
 def to_runner_api(self, context, key_coder, window_coder):
     return beam_runner_api_pb2.TimerFamilySpec(
         time_domain=TimeDomain.to_runner_api(self.time_domain),
         timer_family_coder_id=context.coders.get_id(
             coders._TimerCoder(key_coder, window_coder)))
예제 #7
0
파일: userstate.py 프로젝트: mjacoby/beam
 def to_runner_api(self, context):
     return beam_runner_api_pb2.TimerFamilySpec(
         time_domain=TimeDomain.to_runner_api(self.time_domain),
         timer_family_coder_id=context.coders.get_id(
             coders._TimerCoder(coders.SingletonCoder(None))))
예제 #8
0
 def to_runner_api(self, context):
   return beam_runner_api_pb2.TimerSpec(
       time_domain=TimeDomain.to_runner_api(self.time_domain),
       timer_coder_id=context.coders.get_id(
           coders._TimerCoder(coders.SingletonCoder(None))))