Repository: incubator-systemml
Updated Branches:
  refs/heads/branch-0.13 07f26ca4e -> 83f56f30d


[SYSTEMML-1338] MLContext warning for previous Spark version

Log a warning rather than throw an exception to the user if the
user is using the MLContext API with a version of Spark earlier
than the recommended SystemML minimum Spark version.

Cherry-picked from commit 230bc63c7587440a1608fc014943b5a610b1d7ff.


Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/83f56f30
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/83f56f30
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/83f56f30

Branch: refs/heads/branch-0.13
Commit: 83f56f30d521152a68e83e698819121624fd97b7
Parents: 07f26ca
Author: Deron Eriksson <de...@us.ibm.com>
Authored: Wed Feb 22 11:38:22 2017 -0800
Committer: Deron Eriksson <de...@us.ibm.com>
Committed: Wed Feb 22 11:38:22 2017 -0800

----------------------------------------------------------------------
 .../java/org/apache/sysml/api/mlcontext/MLContext.java  | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/83f56f30/src/main/java/org/apache/sysml/api/mlcontext/MLContext.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/api/mlcontext/MLContext.java 
b/src/main/java/org/apache/sysml/api/mlcontext/MLContext.java
index 2a554d8..3fe4dd0 100644
--- a/src/main/java/org/apache/sysml/api/mlcontext/MLContext.java
+++ b/src/main/java/org/apache/sysml/api/mlcontext/MLContext.java
@@ -26,6 +26,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.log4j.Logger;
 import org.apache.spark.SparkContext;
 import org.apache.spark.api.java.JavaSparkContext;
 import org.apache.sysml.api.DMLScript;
@@ -61,6 +62,11 @@ public class MLContext {
        public static final String SYSTEMML_MINIMUM_SPARK_VERSION = "2.1.0";
 
        /**
+        * Logger for MLContext
+        */
+       public static Logger log = Logger.getLogger(MLContext.class);
+
+       /**
         * SparkContext object.
         */
        private SparkContext sc = null;
@@ -211,7 +217,11 @@ public class MLContext {
         */
        private void initMLContext(SparkContext sc, boolean monitorPerformance) 
{
 
-               MLContextUtil.verifySparkVersionSupported(sc);
+               try {
+                       MLContextUtil.verifySparkVersionSupported(sc);
+               } catch (MLContextException e) {
+                       log.warn("Apache Spark " + 
SYSTEMML_MINIMUM_SPARK_VERSION + " or above is recommended for SystemML " + 
this.info().version());
+               }
 
                if (activeMLContext == null) {
                        System.out.println(MLContextUtil.welcomeMessage());

Reply via email to