Skip to content

[SPARK-7497] [PySpark] [Streaming] fix streaming flaky tests #6239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions python/pyspark/streaming/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@

class PySparkStreamingTestCase(unittest.TestCase):

timeout = 4 # seconds
duration = .2
timeout = 10 # seconds
duration = .5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the duration? Batch duration? Why increase this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's batch duration. These tests became flaky when we change the duration from 1 to 0.2, I'd like to try to change it to 0.5. If they are still flaky, then move to 1 second.


@classmethod
def setUpClass(cls):
Expand Down Expand Up @@ -379,13 +379,13 @@ def func(dstream):

class WindowFunctionTests(PySparkStreamingTestCase):

timeout = 5
timeout = 15

def test_window(self):
input = [range(1), range(2), range(3), range(4), range(5)]

def func(dstream):
return dstream.window(.6, .2).count()
return dstream.window(1.5, .5).count()

expected = [[1], [3], [6], [9], [12], [9], [5]]
self._test_func(input, func, expected)
Expand All @@ -394,7 +394,7 @@ def test_count_by_window(self):
input = [range(1), range(2), range(3), range(4), range(5)]

def func(dstream):
return dstream.countByWindow(.6, .2)
return dstream.countByWindow(1.5, .5)

expected = [[1], [3], [6], [9], [12], [9], [5]]
self._test_func(input, func, expected)
Expand All @@ -403,7 +403,7 @@ def test_count_by_window_large(self):
input = [range(1), range(2), range(3), range(4), range(5), range(6)]

def func(dstream):
return dstream.countByWindow(1, .2)
return dstream.countByWindow(2.5, .5)

expected = [[1], [3], [6], [10], [15], [20], [18], [15], [11], [6]]
self._test_func(input, func, expected)
Expand All @@ -412,7 +412,7 @@ def test_count_by_value_and_window(self):
input = [range(1), range(2), range(3), range(4), range(5), range(6)]

def func(dstream):
return dstream.countByValueAndWindow(1, .2)
return dstream.countByValueAndWindow(2.5, .5)

expected = [[1], [2], [3], [4], [5], [6], [6], [6], [6], [6]]
self._test_func(input, func, expected)
Expand All @@ -421,7 +421,7 @@ def test_group_by_key_and_window(self):
input = [[('a', i)] for i in range(5)]

def func(dstream):
return dstream.groupByKeyAndWindow(.6, .2).mapValues(list)
return dstream.groupByKeyAndWindow(1.5, .5).mapValues(list)

expected = [[('a', [0])], [('a', [0, 1])], [('a', [0, 1, 2])], [('a', [1, 2, 3])],
[('a', [2, 3, 4])], [('a', [3, 4])], [('a', [4])]]
Expand Down