Repository: systemml Updated Branches: refs/heads/master e94374afb -> 2942f89b3
[SYSTEMML-1820] Add isStatistics, isExplain, close methods to Python MLContext Closes #600. Project: http://git-wip-us.apache.org/repos/asf/systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/2942f89b Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/2942f89b Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/2942f89b Branch: refs/heads/master Commit: 2942f89b3573443e588e9fbfb1e33e4cd4658835 Parents: e94374a Author: Glenn Weidner <[email protected]> Authored: Tue Aug 1 14:23:41 2017 -0700 Committer: Glenn Weidner <[email protected]> Committed: Tue Aug 1 14:23:41 2017 -0700 ---------------------------------------------------------------------- src/main/python/systemml/mlcontext.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/systemml/blob/2942f89b/src/main/python/systemml/mlcontext.py ---------------------------------------------------------------------- diff --git a/src/main/python/systemml/mlcontext.py b/src/main/python/systemml/mlcontext.py index 304ea26..1e79648 100644 --- a/src/main/python/systemml/mlcontext.py +++ b/src/main/python/systemml/mlcontext.py @@ -592,8 +592,8 @@ class MLContext(object): Parameters ---------- - sc: SparkContext - SparkContext + sc: SparkContext or SparkSession + An instance of pyspark.SparkContext or pyspark.sql.SparkSession. """ def __init__(self, sc): if isinstance(sc, pyspark.sql.session.SparkSession): @@ -718,3 +718,19 @@ class MLContext(object): def info(self): """Display the project information.""" return self._ml.info().toString() + + def isExplain(self): + """Returns True if program instruction details should be output, False otherwise.""" + return self._ml.isExplain() + + def isStatistics(self): + """Returns True if program execution statistics should be output, False otherwise.""" + return self._ml.isStatistics() + + def close(self): + """ + Closes this MLContext instance to cleanup buffer pool, static/local state and scratch space. + Note the SparkContext is not explicitly closed to allow external reuse. + """ + self._ml.close() + return self
