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

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

                Author: ASF GitHub Bot
            Created on: 26/Oct/18 18:36
            Start Date: 26/Oct/18 18:36
    Worklog Time Spent: 10m 
      Work Description: ajamato 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_r228627266
 
 

 ##########
 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);
+      } else if (draining) {
+        break;
+      }
+      if (readFuture.isDone()) {
 
 Review comment:
   Agreed, rm'd

----------------------------------------------------------------
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: 159312)
    Time Spent: 40m  (was: 0.5h)

> 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: 40m
>  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)

Reply via email to