apache_beam.utils.urns module¶
For internal use only; no backwards-compatibility guarantees.
-
class
apache_beam.utils.urns.
RunnerApiFn
[source]¶ Bases:
object
Abstract base class that provides urn registration utilities.
A class that inherits from this class will get a registration-based from_runner_api and to_runner_api method that convert to and from beam_runner_api_pb2.FunctionSpec.
Additionally, register_pickle_urn can be called from the body of a class to register serialization via pickling.
-
to_runner_api_parameter
(unused_context)[source]¶ Returns the urn and payload for this Fn.
The returned urn(s) should be registered with register_urn.
-
classmethod
register_urn
(urn, parameter_type, fn=None)[source]¶ Registers a urn with a constructor.
For example, if ‘beam:fn:foo’ had parameter type FooPayload, one could write RunnerApiFn.register_urn(‘bean:fn:foo’, FooPayload, foo_from_proto) where foo_from_proto took as arguments a FooPayload and a PipelineContext. This function can also be used as a decorator rather than passing the callable in as the final parameter.
A corresponding to_runner_api_parameter method would be expected that returns the tuple (‘beam:fn:foo’, FooPayload)
-
classmethod
register_pickle_urn
(pickle_urn)[source]¶ Registers and implements the given urn via pickling.
-