[ https://issues.apache.org/jira/browse/BEAM-5850?focusedWorklogId=158293&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-158293 ]
ASF GitHub Bot logged work on BEAM-5850: ---------------------------------------- Author: ASF GitHub Bot Created on: 24/Oct/18 20:11 Start Date: 24/Oct/18 20:11 Worklog Time Spent: 10m Work Description: lukecwik commented on a change in pull request #6786: [BEAM-5850] Add BeamFnDataReceiver and make process, finish and start run on the same thread to support metrics. URL: https://github.com/apache/beam/pull/6786#discussion_r227941568 ########## File path: sdks/java/harness/src/main/java/org/apache/beam/fn/harness/BeamFnDataReadRunner.java ########## @@ -166,14 +177,32 @@ public void registerInputLocation() { apiServiceDescriptor, LogicalEndpoint.of(processBundleInstructionIdSupplier.get(), inputTarget), coder, - receiver); + enqueueElementReceiver); } public void blockTillReadFinishes() throws Exception { LOG.debug( "Waiting for process bundle instruction {} and target {} to close.", processBundleInstructionIdSupplier.get(), inputTarget); - readFuture.awaitCompletion(); + + boolean draining = false; + while (true) { + WindowedValue<OutputT> val = this.queue.poll(50, TimeUnit.MILLISECONDS); + if (val != null) { + // Call receiver. + elementReceiver.accept(val); Review comment: Any exception that happened on the receiver stream would propagate up to the caller since it was happening on the receivers thread and that would cancel the stream. You'll want to make sure that the InboundDataClient is failed if processing fails. Please add a test for this case as well to the BeamFnDataReadRunner suite. Also add a test for making sure that the receiver after the BeamFnDataClient is happening on the same tread as the start/finish functions. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 158293) > Make process, finish and start run on the same thread to support metrics. > ------------------------------------------------------------------------- > > Key: BEAM-5850 > URL: https://issues.apache.org/jira/browse/BEAM-5850 > Project: Beam > Issue Type: New Feature > Components: java-fn-execution > Reporter: Alex Amato > Assignee: Alex Amato > Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > Update BeamFnDataReceiver to place elements into a Queue and consumer then > and call the element processing receiver in blockTillReadFinishes -- This message was sent by Atlassian JIRA (v7.6.3#76005)