Exemple #1
0
 def to_runner_api(self, context):
     # TODO(BEAM-115): Use specialized URNs and components.
     from apache_beam.runners.api import beam_runner_api_pb2
     return beam_runner_api_pb2.Coder(spec=beam_runner_api_pb2.FunctionSpec(
         spec=beam_runner_api_pb2.UrnWithParameter(
             urn=urns.PICKLED_CODER,
             parameter=proto_utils.pack_Any(
                 google.protobuf.wrappers_pb2.BytesValue(
                     value=serialize_coder(self))))))
Exemple #2
0
    def to_runner_api(self, context):
        """Returns an SdkFunctionSpec encoding this Fn.

    Prefer overriding self.to_runner_api_parameter.
    """
        from apache_beam.runners.api import beam_runner_api_pb2
        urn, typed_param = self.to_runner_api_parameter(context)
        return beam_runner_api_pb2.SdkFunctionSpec(
            spec=beam_runner_api_pb2.FunctionSpec(
                urn=urn, parameter=proto_utils.pack_Any(typed_param)))
Exemple #3
0
 def to_runner_api(self, context):
   """For internal use only; no backwards-compatibility guarantees.
   """
   # TODO(BEAM-115): Use specialized URNs and components.
   from apache_beam.runners.api import beam_runner_api_pb2
   return beam_runner_api_pb2.Coder(
       spec=beam_runner_api_pb2.SdkFunctionSpec(
           spec=beam_runner_api_pb2.FunctionSpec(
               urn=urns.PICKLED_CODER,
               parameter=proto_utils.pack_Any(
                   google.protobuf.wrappers_pb2.BytesValue(
                       value=serialize_coder(self))))))
Exemple #4
0
 def to_runner_api(self, context):
     from apache_beam.runners.api import beam_runner_api_pb2
     return beam_runner_api_pb2.PTransform(
         unique_name=self.full_label,
         spec=beam_runner_api_pb2.FunctionSpec(
             urn=urns.PICKLED_TRANSFORM,
             parameter=proto_utils.pack_Any(
                 wrappers_pb2.BytesValue(
                     value=pickler.dumps(self.transform)))),
         subtransforms=[
             context.transforms.get_id(part) for part in self.parts
         ],
         # TODO(BEAM-115): Side inputs.
         inputs={
             tag: context.pcollections.get_id(pc)
             for tag, pc in self.named_inputs().items()
         },
         outputs={
             str(tag): context.pcollections.get_id(out)
             for tag, out in self.named_outputs().items()
         },
         # TODO(BEAM-115): display_data
         display_data=None)
Exemple #5
0
 def to_runner_api(self, context):
     from apache_beam.runners.api import beam_runner_api_pb2
     urn, typed_param = self.to_runner_api_parameter(context)
     return beam_runner_api_pb2.FunctionSpec(
         urn=urn, parameter=proto_utils.pack_Any(typed_param))
Exemple #6
0
 def to_runner_api(self, context):
     urn, typed_param = self.to_runner_api_parameter(context)
     return beam_runner_api_pb2.SdkFunctionSpec(
         spec=beam_runner_api_pb2.FunctionSpec(
             urn=urn, parameter=proto_utils.pack_Any(typed_param)))