You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@predictionio.apache.org by ch...@apache.org on 2018/03/01 21:50:39 UTC
[4/5] predictionio git commit: [PIO-136] Add CleanupFunctions for
Python
[PIO-136] Add CleanupFunctions for Python
This closes #444
Project: http://git-wip-us.apache.org/repos/asf/predictionio/repo
Commit: http://git-wip-us.apache.org/repos/asf/predictionio/commit/161bc0ef
Tree: http://git-wip-us.apache.org/repos/asf/predictionio/tree/161bc0ef
Diff: http://git-wip-us.apache.org/repos/asf/predictionio/diff/161bc0ef
Branch: refs/heads/develop
Commit: 161bc0ef54421d7aa7eab4da98794e14793bf3f4
Parents: a59ef97
Author: Shinsuke Sugaya <sh...@yahoo.co.jp>
Authored: Thu Mar 1 13:44:43 2018 -0800
Committer: Chan Lee <ch...@gmail.com>
Committed: Thu Mar 1 13:49:09 2018 -0800
----------------------------------------------------------------------
python/pypio/shell.py | 2 ++
python/pypio/workflow/__init__.py | 25 +++++++++++++++++++
python/pypio/workflow/cleanup_functions.py | 32 +++++++++++++++++++++++++
3 files changed, 59 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/predictionio/blob/161bc0ef/python/pypio/shell.py
----------------------------------------------------------------------
diff --git a/python/pypio/shell.py b/python/pypio/shell.py
index 94c1e1a..b0295d3 100644
--- a/python/pypio/shell.py
+++ b/python/pypio/shell.py
@@ -16,6 +16,8 @@
#
from pypio.data import PEventStore
+from pypio.workflow import CleanupFunctions
p_event_store = PEventStore(spark._jsparkSession, sqlContext)
+cleanup_functions = CleanupFunctions(sqlContext)
http://git-wip-us.apache.org/repos/asf/predictionio/blob/161bc0ef/python/pypio/workflow/__init__.py
----------------------------------------------------------------------
diff --git a/python/pypio/workflow/__init__.py b/python/pypio/workflow/__init__.py
new file mode 100644
index 0000000..3504e3a
--- /dev/null
+++ b/python/pypio/workflow/__init__.py
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from __future__ import absolute_import
+
+from pypio.workflow.cleanup_functions import CleanupFunctions
+
+
+__all__ = [
+ 'CleanupFunctions'
+]
http://git-wip-us.apache.org/repos/asf/predictionio/blob/161bc0ef/python/pypio/workflow/cleanup_functions.py
----------------------------------------------------------------------
diff --git a/python/pypio/workflow/cleanup_functions.py b/python/pypio/workflow/cleanup_functions.py
new file mode 100644
index 0000000..e4eeb5a
--- /dev/null
+++ b/python/pypio/workflow/cleanup_functions.py
@@ -0,0 +1,32 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from __future__ import absolute_import
+
+__all__ = ["CleanupFunctions"]
+
+
+class CleanupFunctions(object):
+
+ def __init__(self, sql_ctx):
+ self.sql_ctx = sql_ctx
+ self._sc = sql_ctx and sql_ctx._sc
+
+ def run(self):
+ cf = self._sc._jvm.org.apache.predictionio.workflow.CleanupFunctions
+ cf.run()
+