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

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

                Author: ASF GitHub Bot
            Created on: 30/Jan/19 21:57
            Start Date: 30/Jan/19 21:57
    Worklog Time Spent: 10m 
      Work Description: ryan-williams commented on pull request #7656: 
[BEAM-4775] Metrics improvements: make wordcount.py work with attempted metrics
URL: https://github.com/apache/beam/pull/7656#discussion_r252454605
 
 

 ##########
 File path: sdks/python/apache_beam/metrics/execution.py
 ##########
 @@ -122,6 +122,13 @@ def __repr__(self):
     return 'MetricResult(key={}, committed={}, attempted={})'.format(
         self.key, str(self.committed), str(self.attempted))
 
+  @property
+  def result(self):
+    """Short-hand for falling back to attempted metrics if it seems that
+    committed was not populated (e.g. due to not being supported on a given
+    runner"""
+    return self.committed if self.committed else self.attempted
 
 Review comment:
   It is a good question!
   
   I believe "committed" consists only of updates from task-attempts that 
succeeded, whereas "attempted" contains cumulative updates from all 
task-attempts; [this comment in MetricResult is somewhat 
canonical](https://github.com/apache/beam/blob/bb49247808af309a529ab2443b8d779c82970bcb/sdks/java/core/src/main/java/org/apache/beam/sdk/metrics/MetricResult.java#L37-L46).
 I think [this is the original design doc about 
it](https://docs.google.com/document/d/1voyUIQ2DrWkoY-BsJwM8YvF4gGKB76CDG8BYL8XBc7A/edit#heading=h.m3vu8fd66s5y),
 though I think it's out of date now.
   
   Flink only supports "attempted" metrics (in Beam; maybe in general?); 
[here's an example where it only fetches "attempted" metric 
updates](https://github.com/apache/beam/blob/bb49247808af309a529ab2443b8d779c82970bcb/runners/flink/src/main/java/org/apache/beam/runners/flink/metrics/FlinkMetricContainer.java#L145).
 If you have thoughts about the necessity of this restriction from a Flink PoV 
I'd love to hear them!
   
   A confusing thing is that [`MetricContainerImpl` discusses "commit"s to 
`MetricCell`s](https://github.com/apache/beam/blob/bb49247808af309a529ab2443b8d779c82970bcb/runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MetricsContainerImpl.java#L39)
 but I don't think it's referring to the same thing.
 
----------------------------------------------------------------
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: 192526)
    Time Spent: 3h 20m  (was: 3h 10m)

> JobService should support returning metrics
> -------------------------------------------
>
>                 Key: BEAM-4775
>                 URL: https://issues.apache.org/jira/browse/BEAM-4775
>             Project: Beam
>          Issue Type: Bug
>          Components: beam-model
>            Reporter: Eugene Kirpichov
>            Assignee: Ryan Williams
>            Priority: Major
>          Time Spent: 3h 20m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/beam/blob/master/model/job-management/src/main/proto/beam_job_api.proto]
>  currently doesn't appear to have a way for JobService to return metrics to a 
> user, even though 
> [https://github.com/apache/beam/blob/master/model/fn-execution/src/main/proto/beam_fn_api.proto]
>  includes support for reporting SDK metrics to the runner harness.
>  
> Metrics are apparently necessary to run any ValidatesRunner tests because 
> PAssert needs to validate that the assertions succeeded. However, this 
> statement should be double-checked: perhaps it's possible to somehow work 
> with PAssert without metrics support.



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

Reply via email to