You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2019/01/18 08:20:24 UTC

[beam] branch master updated: Deflake progress metrics test with a retry.

This is an automated email from the ASF dual-hosted git repository.

robertwb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new e0f64e9  Deflake progress metrics test with a retry.
     new e1486fc  Merge pull request #7455 Deflake progress metrics test with retry.
e0f64e9 is described below

commit e0f64e9792dc4f7b1019e8cf4e5e9a782f48b6e5
Author: Robert Bradshaw <ro...@google.com>
AuthorDate: Thu Jan 10 10:41:16 2019 +0100

    Deflake progress metrics test with a retry.
    
    Due to the not perfectly determanistic nature of state sampling and sleep,
    this test has a 1% failure rate. Adding a retry rate of 3 drops that to
    one in a million.
---
 sdks/python/apache_beam/runners/portability/fn_api_runner_test.py | 8 ++++++++
 sdks/python/apache_beam/runners/worker/statesampler_test.py       | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/sdks/python/apache_beam/runners/portability/fn_api_runner_test.py b/sdks/python/apache_beam/runners/portability/fn_api_runner_test.py
index dc248d5..ee18739 100644
--- a/sdks/python/apache_beam/runners/portability/fn_api_runner_test.py
+++ b/sdks/python/apache_beam/runners/portability/fn_api_runner_test.py
@@ -26,6 +26,9 @@ import traceback
 import unittest
 from builtins import range
 
+from tenacity import retry
+from tenacity import stop_after_attempt
+
 import apache_beam as beam
 from apache_beam.metrics import monitoring_infos
 from apache_beam.metrics.execution import MetricKey
@@ -565,6 +568,11 @@ class FnApiRunnerTest(unittest.TestCase):
       assert_counter_exists(
           all_metrics_via_montoring_infos, namespace, name, step='MyStep')
 
+  # Due to somewhat non-deterministic nature of state sampling and sleep,
+  # this test is flaky when state duration is low.
+  # Since increasing state duration significantly would also slow down
+  # the test suite, we are retrying twice on failure as a mitigation.
+  @retry(reraise=True, stop=stop_after_attempt(3))
   def test_progress_metrics(self):
     p = self.create_pipeline()
     if not isinstance(p.runner, fn_api_runner.FnApiRunner):
diff --git a/sdks/python/apache_beam/runners/worker/statesampler_test.py b/sdks/python/apache_beam/runners/worker/statesampler_test.py
index 1ff0c5c..176f6e5 100644
--- a/sdks/python/apache_beam/runners/worker/statesampler_test.py
+++ b/sdks/python/apache_beam/runners/worker/statesampler_test.py
@@ -35,7 +35,7 @@ from apache_beam.utils.counters import CounterName
 class StateSamplerTest(unittest.TestCase):
 
   # Due to somewhat non-deterministic nature of state sampling and sleep,
-  # this test is flaky when state duraiton is low.
+  # this test is flaky when state duration is low.
   # Since increasing state duration significantly would also slow down
   # the test suite, we are retrying twice on failure as a mitigation.
   @retry(reraise=True, stop=stop_after_attempt(3))