Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/12673#discussion_r61009830
--- Diff: python/pyspark/sql/streaming.py ---
@@ -87,6 +87,84 @@ def stop(self):
self._jcq.stop()
+class ContinuousQueryManager(object):
+ """A class to manage all the :class:`ContinuousQuery`
ContinuousQueries active
+ on a :class:`SQLContext`.
+
+ .. note:: Experimental
+
+ .. versionadded:: 2.0
+ """
+
+ def __init__(self, jcqm):
+ self._jcqm = jcqm
+
+ @ignore_unicode_prefix
+ @property
+ @since(2.0)
+ def active(self):
+ """Returns a list of active queries associated with this SQLContext
+
+ >>> cq =
df.write.format('memory').queryName('this_query').startStream()
+ >>> cqm = sqlContext.streams
+ >>> # get the list of active continuous queries
+ >>> [q.name for q in cqm.active]
+ [u'this_query']
+ >>> cq.stop()
+ """
+ return [ContinuousQuery(jcq) for jcq in self._jcqm.active()]
+
+ @since(2.0)
+ def get(self, name):
+ """Returns an active query from this SQLContext or throws
exception if an active query
+ with this name doesn't exist.
+
+ >>> df.write.format('memory').queryName('this_query').startStream()
+ >>> cq = sqlContext.streams.get('this_query')
+ >>> cq.isActive
+ True
+ >>> cq.stop()
+ """
+ if name is None or type(name) != str or len(name.strip()) == 0:
+ raise ValueError("The name for the query must be a non-empty
string. Got: %s" % name)
+ return ContinuousQuery(self._jcqm.get(name))
+
+ @since(2.0)
+ def awaitAnyTermination(self, timeoutMs=None):
--- End diff --
In Python, we usually use seconds as duration, can we also use seconds here
(could be different than Scala one)?
---
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]