[
https://issues.apache.org/jira/browse/BEAM-6883?focusedWorklogId=284368&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-284368
]
ASF GitHub Bot logged work on BEAM-6883:
----------------------------------------
Author: ASF GitHub Bot
Created on: 29/Jul/19 16:22
Start Date: 29/Jul/19 16:22
Worklog Time Spent: 10m
Work Description: dmvk commented on pull request #9178: [BEAM-6883]
Improve long-running spark streaming test.
URL: https://github.com/apache/beam/pull/9178#discussion_r308319437
##########
File path:
sdks/java/core/src/test/java/org/apache/beam/sdk/metrics/MetricResultsMatchers.java
##########
@@ -43,9 +43,50 @@
return metricsResult(namespace, name, step, value, true);
}
+ /**
+ * Matches a {@link MetricResult} with the given namespace, name and step,
and a matcher for the
+ * value for either committed or attempted (based on {@code isCommitted})
metrics.
+ */
+ public static <T> Matcher<MetricResult<T>> metricsResult(
+ final String namespace,
+ final String name,
+ final String step,
+ final Matcher<T> valueMatcher,
+ final boolean isCommitted) {
+
+ final String metricState = isCommitted ? "committed" : "attempted";
+ return new MatchNameAndKey<T>(namespace, name, step) {
+ @Override
+ protected boolean matchesSafely(MetricResult<T> item) {
+ final T metricValue = isCommitted ? item.getCommitted() :
item.getAttempted();
+ return super.matchesSafely(item) && valueMatcher.matches(metricValue);
+ }
+
+ @Override
+ public void describeTo(Description description) {
+ super.describeTo(description);
+ description.appendText(String.format(", %s=", metricState));
+ valueMatcher.describeTo(description);
+ description.appendText("}");
+ }
+
+ @Override
+ protected void describeMismatchSafely(MetricResult<T> item, Description
mismatchDescription) {
+ final T metricValue = isCommitted ? item.getCommitted() :
item.getAttempted();
+ super.describeMismatchSafely(item, mismatchDescription);
+ mismatchDescription.appendText(String.format("%s: ", metricState));
+ valueMatcher.describeMismatch(metricValue, mismatchDescription);
+ mismatchDescription.appendText("}");
+ }
+ };
+ }
+
/**
* Matches a {@link MetricResult} with the given namespace, name and step,
and whose value equals
* the given value for either committed or attempted (based on {@code
isCommitted}) metrics.
+ *
+ * <p>For metrics with a {@link {@link GaugeResult}}, only the value is
matched and the timestamp
+ * is ignored.
*/
public static <T> Matcher<MetricResult<T>> metricsResult(
Review comment:
If I understand this correctly, you did diff of failing tests output before
and after the change and there was no difference?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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: 284368)
Time Spent: 1h 20m (was: 1h 10m)
> StreamingSourceMetricsTest takes too long to finish
> ---------------------------------------------------
>
> Key: BEAM-6883
> URL: https://issues.apache.org/jira/browse/BEAM-6883
> Project: Beam
> Issue Type: Test
> Components: runner-spark
> Affects Versions: 2.11.0
> Reporter: Ismaël Mejía
> Assignee: Ryan Skraba
> Priority: Minor
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> This test is part of Spark's ValidatesRunner suite and it takes more than 10
> minutes to end.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)