[ 
https://issues.apache.org/jira/browse/BEAM-6894?focusedWorklogId=232797&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-232797
 ]

ASF GitHub Bot logged work on BEAM-6894:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Apr/19 12:38
            Start Date: 25/Apr/19 12:38
    Worklog Time Spent: 10m 
      Work Description: robertwb commented on pull request #8270: [BEAM-6894] 
Support for constructing a Dataflow job request that includes cross-language 
transforms
URL: https://github.com/apache/beam/pull/8270#discussion_r278522031
 
 

 ##########
 File path: sdks/python/apache_beam/transforms/core.py
 ##########
 @@ -297,6 +298,51 @@ def get_function_arguments(obj, func):
   return getfullargspec(f)
 
 
+class RunnerAPIProtoHolder(object):
+  """An object for holding runner API protos for constructing a Python 
pipeline.
+
+  This is used for transforms, coders, etc. for which corresponding objects
+  cannot be initialized in Python SDK. For example, for `ParDo` transforms for
+  remote SDKs that may be available in Python SDK transform graph when 
expanding
+  a cross-language transform since a Python `ParDo` object cannot be generated
+  without a serialized Python `DoFn` object.
+  """
+
+  def __init__(self, proto):
+    self._proto = proto
+
+  def proto(self):
+    """Runner API payload for constructing the Python pipeline construct."""
+    return self._proto
+
+
+class RunnerAPIPTransformHolder(RunnerAPIProtoHolder, PTransform):
+  """A `RunnerAPIProtoHolder` for `PTransform`s"""
+
+  def to_runner_api(self, context, has_parts=False):
+    return self._proto
+
+  @staticmethod
+  def is_external_transform(proto):
+    if proto.urn != python_urns.PICKLED_TRANSFORM:
+      return True
+
+
+class RunnerAPICoderHolder(RunnerAPIProtoHolder, Coder):
+  """A `RunnerAPIProtoHolder` for `Coder`s"""
+
+  def to_runner_api(self, context):
+    return self._proto
+
+  def to_type_hint(self):
+    return typehints.Any
+
+  @staticmethod
+  def is_external_coder(proto):
+    if proto.spec.spec.urn != python_urns.PICKLED_CODER:
 
 Review comment:
   This isn't correct, e.g. all the standard coders. Similarly for 
is_external_transform. I'd just remove those methods. 
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 232797)

> ExternalTransform.expand() does not create the proper AppliedPTransform 
> sub-graph
> ---------------------------------------------------------------------------------
>
>                 Key: BEAM-6894
>                 URL: https://issues.apache.org/jira/browse/BEAM-6894
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>            Reporter: Chamikara Jayalath
>            Assignee: Chamikara Jayalath
>            Priority: Major
>          Time Spent: 6h 10m
>  Remaining Estimate: 0h
>
> 'ExternalTransform.expand()' can be used to expand a remote transform and 
> build the correct runner-api subgraph for that transform. However currently 
> we do not modify the AppliedPTransform sub-graph correctly during this 
> process. Relevant code location here.
> [https://github.com/apache/beam/blob/master/sdks/python/apache_beam/transforms/external.py#L135]
>  
> Without this, DataflowRunner that relies in this object graph (not just the 
> runner API proto) to build the job submission request to Dataflow service 
> cannot construct this request properly.
>  
> cc: [~robertwb]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to