Exemplo n.º 1
0
 def open(self, runtime_context: RuntimeContext):
     state_descriptor = ValueStateDescriptor("state", Types.FLOAT())
     state_ttl_config = StateTtlConfig \
         .new_builder(Time.seconds(1)) \
         .set_update_type(StateTtlConfig.UpdateType.OnReadAndWrite) \
         .disable_cleanup_in_background() \
         .build()
     state_descriptor.enable_time_to_live(state_ttl_config)
     self.state = runtime_context.get_state(state_descriptor)
Exemplo n.º 2
0
 def open(self, runtime_context: RuntimeContext):
     value_state_descriptor = ValueStateDescriptor(
         'value_state', Types.INT())
     self.value_state = runtime_context.get_state(
         value_state_descriptor)
     list_state_descriptor = ListStateDescriptor(
         'list_state', Types.INT())
     self.list_state = runtime_context.get_list_state(
         list_state_descriptor)
     map_state_descriptor = MapStateDescriptor(
         'map_state', Types.INT(), Types.STRING())
     self.map_state = runtime_context.get_map_state(
         map_state_descriptor)
Exemplo n.º 3
0
 def open(self, ctx: Context[Any, CountWindow]):
     count_descriptor = ValueStateDescriptor('slide-count-assigner',
                                             Types.LONG())
     self._count = ctx.get_partitioned_state(count_descriptor)
 def open(self, runtime_context: RuntimeContext):
     state_desc = ValueStateDescriptor('cnt', Types.LONG())
     self.cnt_state = runtime_context.get_state(state_desc)
Exemplo n.º 5
0
 def __init__(self, count_elements: int):
     self._count_elements = count_elements
     self._count_state_desc = ValueStateDescriptor(
         "trigger-count-%s" % count_elements, Types.LONG())
     self._ctx = None  # type: TriggerContext
Exemplo n.º 6
0
 def open(self, ctx: Context[Any, CountWindow]):
     value_state_descriptor = ValueStateDescriptor('tumble-count-assigner',
                                                   Types.PICKLED_BYTE_ARRAY())
     self._count = ctx.get_partitioned_state(value_state_descriptor)