Repository: spark
Updated Branches:
  refs/heads/branch-1.5 d31b312fc -> 9522dd23d


[SPARK-11378][STREAMING] make StreamingContext.awaitTerminationOrTimeout return 
properly

This adds a failing test checking that `awaitTerminationOrTimeout` returns the 
expected value, and then fixes that failing test with the addition of a 
`return`.

tdas zsxwing

Author: Nick Evans <m...@nicolasevans.org>

Closes #9336 from manygrams/fix_await_termination_or_timeout.

(cherry picked from commit 859dff56eb0f8c63c86e7e900a12340c199e6247)
Signed-off-by: Sean Owen <so...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/9522dd23
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/9522dd23
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/9522dd23

Branch: refs/heads/branch-1.5
Commit: 9522dd23d5b059c76f32b0a288389b03b6c971a8
Parents: d31b312
Author: Nick Evans <m...@nicolasevans.org>
Authored: Thu Nov 5 09:18:20 2015 +0000
Committer: Sean Owen <so...@cloudera.com>
Committed: Thu Nov 5 09:18:33 2015 +0000

----------------------------------------------------------------------
 python/pyspark/streaming/context.py | 2 +-
 python/pyspark/streaming/tests.py   | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/9522dd23/python/pyspark/streaming/context.py
----------------------------------------------------------------------
diff --git a/python/pyspark/streaming/context.py 
b/python/pyspark/streaming/context.py
index a8c9ffc..3a8f949 100644
--- a/python/pyspark/streaming/context.py
+++ b/python/pyspark/streaming/context.py
@@ -256,7 +256,7 @@ class StreamingContext(object):
 
         @param timeout: time to wait in seconds
         """
-        self._jssc.awaitTerminationOrTimeout(int(timeout * 1000))
+        return self._jssc.awaitTerminationOrTimeout(int(timeout * 1000))
 
     def stop(self, stopSparkContext=True, stopGraceFully=False):
         """

http://git-wip-us.apache.org/repos/asf/spark/blob/9522dd23/python/pyspark/streaming/tests.py
----------------------------------------------------------------------
diff --git a/python/pyspark/streaming/tests.py 
b/python/pyspark/streaming/tests.py
index a8c7b51..824f356 100644
--- a/python/pyspark/streaming/tests.py
+++ b/python/pyspark/streaming/tests.py
@@ -585,6 +585,13 @@ class StreamingContextTests(PySparkStreamingTestCase):
         self.ssc = StreamingContext.getActiveOrCreate(None, setupFunc)
         self.assertTrue(self.setupCalled)
 
+    def test_await_termination_or_timeout(self):
+        self._add_input_stream()
+        self.ssc.start()
+        self.assertFalse(self.ssc.awaitTerminationOrTimeout(0.001))
+        self.ssc.stop(False)
+        self.assertTrue(self.ssc.awaitTerminationOrTimeout(0.001))
+
 
 class CheckpointTests(unittest.TestCase):
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to