Repository: incubator-systemml
Updated Branches:
  refs/heads/master 479819988 -> 230bc63c7


[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.


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

Branch: refs/heads/master
Commit: 230bc63c7587440a1608fc014943b5a610b1d7ff
Parents: 4798199
Author: Deron Eriksson <[email protected]>
Authored: Mon Feb 20 15:19:58 2017 -0800
Committer: Deron Eriksson <[email protected]>
Committed: Mon Feb 20 15:19:58 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/230bc63c/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