[SYSTEMML-944] Fix mlcontext default explain type (runtime, not hops) 

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

Branch: refs/heads/master
Commit: 3d523b851313986c047b2be008de57333caf44c9
Parents: 0d9e7b2
Author: Matthias Boehm <mbo...@us.ibm.com>
Authored: Mon Sep 19 14:30:20 2016 -0700
Committer: Matthias Boehm <mbo...@us.ibm.com>
Committed: Mon Sep 19 14:30:20 2016 -0700

----------------------------------------------------------------------
 .../sysml/api/mlcontext/ScriptExecutor.java       | 18 ++++++------------
 .../mlcontext/MLContextMultipleScriptsTest.java   |  2 --
 2 files changed, 6 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/3d523b85/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java 
b/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java
index 2973ed2..17bae7a 100644
--- a/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java
+++ b/src/main/java/org/apache/sysml/api/mlcontext/ScriptExecutor.java
@@ -200,19 +200,13 @@ public class ScriptExecutor {
        protected void showExplanation() {
                if (explain) {
                        try {
-                               if (explainLevel == null) {
-                                       
System.out.println(Explain.explain(dmlProgram));
-                               } else {
-                                       ExplainType explainType = 
explainLevel.getExplainType();
-                                       
System.out.println(Explain.explain(dmlProgram, runtimeProgram, explainType));
-                               }
-                       } catch (HopsException e) {
-                               throw new MLContextException("Exception 
occurred while explaining dml program", e);
-                       } catch (DMLRuntimeException e) {
+                               ExplainType explainType = (explainLevel != 
null) ? 
+                                               explainLevel.getExplainType() : 
ExplainType.RUNTIME;
+                               System.out.println(Explain.explain(dmlProgram, 
runtimeProgram, explainType));
+                       } 
+                       catch (Exception e) {
                                throw new MLContextException("Exception 
occurred while explaining dml program", e);
-                       } catch (LanguageException e) {
-                               throw new MLContextException("Exception 
occurred while explaining dml program", e);
-                       }
+                       } 
                }
        }
 

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/3d523b85/src/test/java/org/apache/sysml/test/integration/mlcontext/MLContextMultipleScriptsTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/sysml/test/integration/mlcontext/MLContextMultipleScriptsTest.java
 
b/src/test/java/org/apache/sysml/test/integration/mlcontext/MLContextMultipleScriptsTest.java
index 7f2dfaf..e0e784c 100644
--- 
a/src/test/java/org/apache/sysml/test/integration/mlcontext/MLContextMultipleScriptsTest.java
+++ 
b/src/test/java/org/apache/sysml/test/integration/mlcontext/MLContextMultipleScriptsTest.java
@@ -28,7 +28,6 @@ import org.apache.spark.api.java.JavaSparkContext;
 import org.apache.sysml.api.DMLScript;
 import org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM;
 import org.apache.sysml.api.mlcontext.MLContext;
-import org.apache.sysml.api.mlcontext.MLContext.ExplainLevel;
 import org.apache.sysml.api.mlcontext.Matrix;
 import org.apache.sysml.api.mlcontext.Script;
 import org.apache.sysml.test.integration.AutomatedTestBase;
@@ -96,7 +95,6 @@ public class MLContextMultipleScriptsTest extends 
AutomatedTestBase
                JavaSparkContext sc = new JavaSparkContext(conf);
                MLContext ml = new MLContext(sc);
                ml.setExplain(true);
-               ml.setExplainLevel(ExplainLevel.RUNTIME);
                
                String dml1 = baseDirectory + File.separator + 
"MultiScript1.dml";
                String dml2 = baseDirectory + File.separator + 
(wRead?"MultiScript2b.dml":"MultiScript2.dml");

Reply via email to