Jonathan Feinberg
01/02/2024, 1:30 PMclass Function(KeyedCoProcessFunction):
parameter: Types.STRING
def open(self, runtime_context: RuntimeContext) -> None:
ttl_config = (
StateTtlConfig.new_builder(Time.days(1))
.set_update_type(StateTtlConfig.UpdateType.OnReadAndWrite)
.set_state_visibility(StateTtlConfig.StateVisibility.NeverReturnExpired)
.build()
)
self.parameter = runtime_context.get_state(
ValueStateDescriptor(f"Value store for parameter", Types.STRING())
)
self.parameter.enable_time_to_live(ttl_config)
def process_element1(self, value, ctx: KeyedCoProcessFunction.Context) -> None:
self.parameter.value() # line that fails
...
...
Works fine for the most part, but I get errors from time to time. Anyone knows why I'm getting this error?Yuval Itzchakov
01/02/2024, 1:39 PMJonathan Feinberg
01/02/2024, 1:47 PMJonathan Feinberg
01/02/2024, 1:48 PM