[
https://issues.apache.org/jira/browse/BEAM-6894?focusedWorklogId=226612&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-226612
]
ASF GitHub Bot logged work on BEAM-6894:
----------------------------------------
Author: ASF GitHub Bot
Created on: 12/Apr/19 12:07
Start Date: 12/Apr/19 12:07
Worklog Time Spent: 10m
Work Description: robertwb commented on pull request #8270: [BEAM-6894]
Updates Dataflow runner to support external ParDos.
URL: https://github.com/apache/beam/pull/8270#discussion_r274867714
##########
File path: sdks/python/apache_beam/transforms/core.py
##########
@@ -297,6 +297,45 @@ def get_function_arguments(obj, func):
return getfullargspec(f)
+class RunnerAPIProtoHolder(object):
+ """An object for holding runner API payload for constructing a transform.
+
+ This is used for transforms for which transform 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, urn):
+ self._proto = proto
+ self._urn = urn
+
+ def proto(self):
+ """Runner API payload for constructing the transform.
+
+ Exact definition of the Payload depends on the transform. For example, for
a
+ ParDo transform, this will be a `ParDoPayload` object.
+ """
+ return self._proto
+
+ def urn(self):
+ """URN of the transform."""
+ return self._urn
+
+
+class RunnerAPIPTransformHolder(RunnerAPIProtoHolder, PTransform):
+ """A `RunnerAPIProtoHolder` for `PTransform`s"""
+
+ def to_runner_api(self, context, has_parts=False):
+ if self.urn() == common_urns.primitives.PAR_DO.urn:
Review comment:
No need to limit ourselves here.
----------------------------------------------------------------
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: 226612)
Time Spent: 2h 20m (was: 2h 10m)
> 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: 2h 20m
> 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)