[
https://issues.apache.org/jira/browse/BEAM-5886?focusedWorklogId=159747&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-159747
]
ASF GitHub Bot logged work on BEAM-5886:
----------------------------------------
Author: ASF GitHub Bot
Created on: 28/Oct/18 19:46
Start Date: 28/Oct/18 19:46
Worklog Time Spent: 10m
Work Description: kennknowles commented on a change in pull request
#6863: [BEAM-5886] Fix incorrectly formulated condition in checkState method
URL: https://github.com/apache/beam/pull/6863#discussion_r228762037
##########
File path:
sdks/java/testing/test-utils/src/main/java/org/apache/beam/sdk/testutils/metrics/MetricsReader.java
##########
@@ -124,9 +124,12 @@ private long getDistributionMetric(String name,
DistributionType distType, long
private <T> void checkIfMetricResultIsUnique(String name,
Iterable<MetricResult<T>> metricResult)
throws IllegalStateException {
+ int resultCount = Iterables.size(metricResult);
Preconditions.checkState(
- Iterables.size(metricResult) == 1,
- String.format("More than one metric matches name: %s in namespace
%s.", name, namespace));
+ resultCount <= 1,
+ String.format(
Review comment:
Actually this should be just `checkState(resultCount <= 1, "..", name,
namespace, resultCount)` so that it does not execute the String.format when the
check passes.
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 159747)
Time Spent: 50m (was: 40m)
> Nexmark failing due to IllegalStateException
> --------------------------------------------
>
> Key: BEAM-5886
> URL: https://issues.apache.org/jira/browse/BEAM-5886
> Project: Beam
> Issue Type: Task
> Components: test-failures, testing
> Reporter: Lukasz Gajowy
> Assignee: Lukasz Gajowy
> Priority: Major
> Time Spent: 50m
> Remaining Estimate: 0h
>
> Nexmark fails due to the following error:
>
> {code:java}
> java.lang.RuntimeException: java.lang.IllegalStateException: More than one
> metric matches name: fatal in namespace Query0.
> 13:05:49 0012 *** not run ***
> 13:05:49
> ==========================================================================================
> 13:05:49 at org.apache.beam.sdk.nexmark.Main.runAll(Main.java:144)
> 13:05:49
> 13:05:49 at org.apache.beam.sdk.nexmark.Main.main(Main.java:477)
> 13:05:49 Caused by: java.lang.IllegalStateException: More than one metric
> matches name: fatal in namespace Query0.
> 13:05:49 at
> org.apache.beam.repackaged.beam_sdks_java_test_utils.com.google.common.base.Preconditions.checkState(Preconditions.java:444)
> 13:05:49 at
> org.apache.beam.sdk.testutils.metrics.MetricsReader.checkIfMetricResultIsUnique(MetricsReader.java:127)
> 13:05:49 at
> org.apache.beam.sdk.testutils.metrics.MetricsReader.getCounterMetric(MetricsReader.java:65)
> 13:05:49 at
> org.apache.beam.sdk.nexmark.NexmarkLauncher.monitor(NexmarkLauncher.java:447)
> 13:05:49 at
> org.apache.beam.sdk.nexmark.NexmarkLauncher.run(NexmarkLauncher.java:1156)
> 13:05:49 at org.apache.beam.sdk.nexmark.Main$Run.call(Main.java:108)
> 13:05:49 at org.apache.beam.sdk.nexmark.Main$Run.call(Main.java:96)
> 13:05:49 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> 13:05:49 at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> 13:05:49 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> 13:05:49 at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> 13:05:49 at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> 13:05:49 at java.lang.Thread.run(Thread.java:748)
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)