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

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

                Author: ASF GitHub Bot
            Created on: 07/Dec/18 21:10
            Start Date: 07/Dec/18 21:10
    Worklog Time Spent: 10m 
      Work Description: ajamato commented on a change in pull request #6799: 
[BEAM-6138] Add User Counter Metric Support to Java SDK
URL: https://github.com/apache/beam/pull/6799#discussion_r239947182
 
 

 ##########
 File path: 
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/control/ProcessBundleHandler.java
 ##########
 @@ -278,23 +304,42 @@ private void 
createRunnerAndConsumersForPTransformRecursively(
             splitListener);
       }
 
-      // Already in reverse topological order so we don't need to do anything.
-      for (ThrowingRunnable startFunction : startFunctions) {
-        LOG.debug("Starting function {}", startFunction);
-        startFunction.run();
-      }
+      MetricsContainerImpl metricsContainer = new 
MetricsContainerImpl(request.getInstructionId());
+      try (Closeable closeable = 
MetricsEnvironment.scopedMetricsContainer(metricsContainer)) {
+        // Already in reverse topological order so we don't need to do 
anything.
+        for (ThrowingRunnable startFunction : startFunctions) {
+          LOG.debug("Starting function {}", startFunction);
+          startFunction.run();
+        }
 
-      // Need to reverse this since we want to call finish in topological 
order.
-      for (ThrowingRunnable finishFunction : Lists.reverse(finishFunctions)) {
-        LOG.debug("Finishing function {}", finishFunction);
-        finishFunction.run();
-      }
-      if (!allResiduals.isEmpty()) {
-        response.addAllResidualRoots(allResiduals.values());
+        if (hasReadPTransform) {
+          // This will trigger the process() call on each element indirectly.
+          queueingClient.drainAndBlock();
+        }
+
+        // Need to reverse this since we want to call finish in topological 
order.
+        for (ThrowingRunnable finishFunction : Lists.reverse(finishFunctions)) 
{
+          LOG.debug("Finishing function {}", finishFunction);
+          finishFunction.run();
+        }
+
+        // Extract user metrics and store as MonitoringInfos.
+        MetricUpdates mus = metricsContainer.getUpdates();
 
 Review comment:
   Done

----------------------------------------------------------------
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: 173063)
    Time Spent: 1h 20m  (was: 1h 10m)

> Add User Metric Support to Java SDK
> -----------------------------------
>
>                 Key: BEAM-6138
>                 URL: https://issues.apache.org/jira/browse/BEAM-6138
>             Project: Beam
>          Issue Type: New Feature
>          Components: java-fn-execution
>            Reporter: Alex Amato
>            Assignee: Alex Amato
>            Priority: Major
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>




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

Reply via email to