apache_beam.transforms.userstate module¶
User-facing interfaces for the Beam State and Timer APIs.
Experimental; no backwards-compatibility guarantees.
-
class
apache_beam.transforms.userstate.StateSpec[source]¶ Bases:
future.types.newobject.newobjectSpecification for a user DoFn state cell.
-
class
apache_beam.transforms.userstate.BagStateSpec(name, coder)[source]¶ Bases:
apache_beam.transforms.userstate.StateSpecSpecification for a user DoFn bag state cell.
-
class
apache_beam.transforms.userstate.CombiningValueStateSpec(name, coder, combine_fn)[source]¶ Bases:
apache_beam.transforms.userstate.StateSpecSpecification for a user DoFn combining value state cell.
-
class
apache_beam.transforms.userstate.TimerSpec(name, time_domain)[source]¶ Bases:
future.types.newobject.newobjectSpecification for a user stateful DoFn timer.
-
apache_beam.transforms.userstate.on_timer(timer_spec)[source]¶ Decorator for timer firing DoFn method.
This decorator allows a user to specify an on_timer processing method in a stateful DoFn. Sample usage:
class MyDoFn(DoFn): TIMER_SPEC = TimerSpec('timer', TimeDomain.WATERMARK) @on_timer(TIMER_SPEC) def my_timer_expiry_callback(self): logging.info('Timer expired!')
-
apache_beam.transforms.userstate.get_dofn_specs(dofn)[source]¶ Gets the state and timer specs for a DoFn, if any.
-
apache_beam.transforms.userstate.is_stateful_dofn(dofn)[source]¶ Determines whether a given DoFn is a stateful DoFn.
-
apache_beam.transforms.userstate.validate_stateful_dofn(dofn)[source]¶ Validates the proper specification of a stateful DoFn.
-
class
apache_beam.transforms.userstate.RuntimeTimer(timer_spec)[source]¶ Bases:
future.types.newobject.newobjectTimer interface object passed to user code.
-
class
apache_beam.transforms.userstate.RuntimeState(state_spec, state_tag, current_value_accessor)[source]¶ Bases:
future.types.newobject.newobjectState interface object passed to user code.
-
class
apache_beam.transforms.userstate.BagRuntimeState(state_spec, state_tag, current_value_accessor)[source]¶ Bases:
apache_beam.transforms.userstate.RuntimeStateBag state interface object passed to user code.
-
class
apache_beam.transforms.userstate.CombiningValueRuntimeState(state_spec, state_tag, current_value_accessor)[source]¶ Bases:
apache_beam.transforms.userstate.RuntimeStateCombining value state interface object passed to user code.