You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ib...@apache.org on 2020/07/22 20:34:14 UTC
[beam] branch master updated: [BEAM-10546] Remove util.timeout
This is an automated email from the ASF dual-hosted git repository.
ibzib 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 0968ad3 [BEAM-10546] Remove util.timeout
new c739f92 Merge pull request #12332 from ibzib/BEAM-10546
0968ad3 is described below
commit 0968ad39b30d823a9b3a84fade9a1056637301ee
Author: Kyle Weaver <kc...@google.com>
AuthorDate: Tue Jul 21 15:54:51 2020 -0700
[BEAM-10546] Remove util.timeout
util.timeout is obsolete since the resolution of BEAM-9009.
---
.../runners/interactive/interactive_runner_test.py | 2 --
.../apache_beam/runners/worker/data_plane_test.py | 3 --
.../runners/worker/worker_status_test.py | 3 --
sdks/python/apache_beam/testing/util.py | 42 ----------------------
4 files changed, 50 deletions(-)
diff --git a/sdks/python/apache_beam/runners/interactive/interactive_runner_test.py b/sdks/python/apache_beam/runners/interactive/interactive_runner_test.py
index 32961b7..51cfeb7 100644
--- a/sdks/python/apache_beam/runners/interactive/interactive_runner_test.py
+++ b/sdks/python/apache_beam/runners/interactive/interactive_runner_test.py
@@ -39,7 +39,6 @@ from apache_beam.runners.interactive import interactive_environment as ie
from apache_beam.runners.interactive import interactive_runner
from apache_beam.runners.interactive.testing.mock_ipython import mock_get_ipython
from apache_beam.testing.test_stream import TestStream
-from apache_beam.testing.util import timeout
from apache_beam.transforms.window import GlobalWindow
from apache_beam.transforms.window import IntervalWindow
from apache_beam.utils.timestamp import Timestamp
@@ -155,7 +154,6 @@ class InteractiveRunnerTest(unittest.TestCase):
@unittest.skipIf(
sys.version_info < (3, 5, 3),
'The tests require at least Python 3.6 to work.')
- @timeout(60)
def test_streaming_wordcount(self):
class WordExtractingDoFn(beam.DoFn):
def process(self, element):
diff --git a/sdks/python/apache_beam/runners/worker/data_plane_test.py b/sdks/python/apache_beam/runners/worker/data_plane_test.py
index 4f09df3..dba349f 100644
--- a/sdks/python/apache_beam/runners/worker/data_plane_test.py
+++ b/sdks/python/apache_beam/runners/worker/data_plane_test.py
@@ -33,16 +33,13 @@ from apache_beam.portability.api import beam_fn_api_pb2
from apache_beam.portability.api import beam_fn_api_pb2_grpc
from apache_beam.runners.worker import data_plane
from apache_beam.runners.worker.worker_id_interceptor import WorkerIdInterceptor
-from apache_beam.testing.util import timeout
from apache_beam.utils import thread_pool_executor
class DataChannelTest(unittest.TestCase):
- @timeout(5)
def test_grpc_data_channel(self):
self._grpc_data_channel_test()
- @timeout(5)
def test_time_based_flush_grpc_data_channel(self):
self._grpc_data_channel_test(True)
diff --git a/sdks/python/apache_beam/runners/worker/worker_status_test.py b/sdks/python/apache_beam/runners/worker/worker_status_test.py
index fea0d73..b98c6bd 100644
--- a/sdks/python/apache_beam/runners/worker/worker_status_test.py
+++ b/sdks/python/apache_beam/runners/worker/worker_status_test.py
@@ -27,7 +27,6 @@ import mock
from apache_beam.portability.api import beam_fn_api_pb2
from apache_beam.portability.api import beam_fn_api_pb2_grpc
from apache_beam.runners.worker.worker_status import FnApiWorkerStatusHandler
-from apache_beam.testing.util import timeout
from apache_beam.utils import thread_pool_executor
@@ -63,7 +62,6 @@ class FnApiWorkerStatusHandlerTest(unittest.TestCase):
def tearDown(self):
self.server.stop(5)
- @timeout(5)
def test_send_status_response(self):
self.test_status_service.finished.acquire()
while len(self.test_status_service.response_received) < self.num_request:
@@ -73,7 +71,6 @@ class FnApiWorkerStatusHandlerTest(unittest.TestCase):
self.assertIsNotNone(response.status_info)
self.fn_status_handler.close()
- @timeout(5)
@mock.patch(
'apache_beam.runners.worker.worker_status'
'.FnApiWorkerStatusHandler.generate_status_response')
diff --git a/sdks/python/apache_beam/testing/util.py b/sdks/python/apache_beam/testing/util.py
index 5254ea5..110ec41 100644
--- a/sdks/python/apache_beam/testing/util.py
+++ b/sdks/python/apache_beam/testing/util.py
@@ -24,13 +24,9 @@ from __future__ import absolute_import
import collections
import glob
import io
-import sys
import tempfile
-import threading
from builtins import object
-from future.utils import raise_
-
from apache_beam import pvalue
from apache_beam.transforms import window
from apache_beam.transforms.core import Create
@@ -338,41 +334,3 @@ def open_shards(glob_pattern, mode='rt', encoding='utf-8'):
out_file.write(in_file.read())
concatenated_file_name = out_file.name
return io.open(concatenated_file_name, mode, encoding=encoding)
-
-
-def timeout(timeout_secs):
- """Test timeout method decorator.
-
- Annotate test method so that test will fail immediately after
- test run took longer time than the specified timeout.
-
- Examples:
-
- @timeout(5)
- def test_some_function(self):
- ...
-
- """
- def decorate(fn):
- exc_info = []
-
- def wrapper(*args, **kwargs):
- def call_fn():
- try:
- fn(*args, **kwargs)
- except: # pylint: disable=bare-except
- exc_info[:] = sys.exc_info()
-
- thread = threading.Thread(target=call_fn)
- thread.daemon = True
- thread.start()
- thread.join(timeout_secs)
- if exc_info:
- t, v, tb = exc_info # pylint: disable=unbalanced-tuple-unpacking
- raise_(t, v, tb)
- assert not thread.is_alive(), 'timed out after %s seconds' % timeout_secs
-
- wrapper.__name__ = fn.__name__
- return wrapper
-
- return decorate