[
https://issues.apache.org/jira/browse/BEAM-6894?focusedWorklogId=226618&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-226618
]
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_r274875677
##########
File path: sdks/python/apache_beam/transforms/external_test.py
##########
@@ -246,6 +248,59 @@ def test_java_expansion(self):
finally:
server.kill()
+ def test_java_expansion_dataflow(self):
+ if not self.expansion_service_jar:
+ raise unittest.SkipTest('No expansion service jar provided.')
+
+ from apache_beam.runners.dataflow.internal.apiclient import
DataflowApplicationClient
+
+ with patch.object(
+ DataflowApplicationClient, 'create_job') as mock_create_job:
+
+ # The actual definitions of these transforms is in
+ # org.apache.beam.runners.core.construction.TestExpansionService.
+ TEST_FILTER_URN = "pytest:beam:transforms:filter_less_than"
+
+ # Run as cheaply as possible on the portable runner.
+ options = PipelineOptions(
+ runner='DataflowRunner',
+ project='dummyproject',
+ temp_location='gs://dummybucket/',
+ experiments=['beam_fn_api', 'use_unified_worker',
+ 'cross_language_pipeline'])
+
+ try:
+ # Start the java server and wait for it to be ready.
+ port = '8091'
+ address = 'localhost:%s' % port
+ server = subprocess.Popen(
+ ['java', '-jar', self.expansion_service_jar, port])
+ with grpc.insecure_channel(address) as channel:
+ grpc.channel_ready_future(channel).result()
+
+ # Run a simple count-filtered-letters pipeline.
+ p = beam.Pipeline(options=options)
+ # pylint: disable=expression-not-assigned
+ (
+ p
+ | beam.Create(list('aaabccxyyzzz'))
+ | beam.Map(unicode)
+ # TODO(BEAM-6587): Use strings directly rather than ints.
+ | beam.Map(lambda x: int(ord(x)))
+ | beam.ExternalTransform(TEST_FILTER_URN, b'middle', address)
+ # TODO(BEAM-6587): Remove when above is removed.
+ | beam.Map(lambda v: chr(v)))
+ p.run()
Review comment:
If there's a reason to use p.run() rather than the with format, please
comment.
----------------------------------------------------------------
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: 226618)
Time Spent: 3h 20m (was: 3h 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: 3h 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)