Github user tdas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12673#discussion_r61312053
  
    --- Diff: python/pyspark/sql/tests.py ---
    @@ -990,6 +996,31 @@ def test_stream_await_termination(self):
             cq.stop()
             shutil.rmtree(tmpPath)
     
    +    def test_query_manager_await_termination(self):
    +        df = 
self.sqlCtx.read.format('text').stream('python/test_support/sql/streaming')
    +        for cq in self.sqlCtx.streams.active:
    +            cq.stop()
    +        tmpPath = tempfile.mkdtemp()
    +        shutil.rmtree(tmpPath)
    +        self.assertTrue(df.isStreaming)
    +        out = os.path.join(tmpPath, 'out')
    +        chk = os.path.join(tmpPath, 'chk')
    +        cq = df.write.startStream(path=out, format='parquet', 
queryName='this_query',
    +                                  checkpointLocation=chk)
    +        self.assertTrue(cq.isActive)
    +        try:
    +            self.sqlCtx.streams.awaitAnyTermination("hello")
    +            self.fail("Expected a value exception")
    +        except ValueError:
    +            pass
    +        now = time.time()
    +        res = self.sqlCtx.streams.awaitAnyTermination(2600)  # test should 
take at least 2 seconds
    +        duration = time.time() - now
    +        self.assertTrue(duration >= 2)
    +        self.assertFalse(res)
    +        cq.stop()
    --- End diff --
    
    shouldnt this be in a finally of sorts?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to