You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by de...@apache.org on 2016/09/15 22:05:11 UTC
incubator-systemml git commit: [SYSTEMML-915] Fix MLContext tests in
single JVM
Repository: incubator-systemml
Updated Branches:
refs/heads/master 32fa72621 -> 0f243b8f4
[SYSTEMML-915] Fix MLContext tests in single JVM
Closes #240.
Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/0f243b8f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/0f243b8f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/0f243b8f
Branch: refs/heads/master
Commit: 0f243b8f433500dc30fac9c7c56bb9de769f3800
Parents: 32fa726
Author: Deron Eriksson <de...@us.ibm.com>
Authored: Thu Sep 15 15:02:14 2016 -0700
Committer: Deron Eriksson <de...@us.ibm.com>
Committed: Thu Sep 15 15:02:14 2016 -0700
----------------------------------------------------------------------
.../functions/mlcontext/FrameTest.java | 14 +++++++--
.../functions/mlcontext/GNMFTest.java | 32 +++++++++++++-------
2 files changed, 32 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/0f243b8f/src/test/java/org/apache/sysml/test/integration/functions/mlcontext/FrameTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/functions/mlcontext/FrameTest.java b/src/test/java/org/apache/sysml/test/integration/functions/mlcontext/FrameTest.java
index b3324df..d12f6f2 100644
--- a/src/test/java/org/apache/sysml/test/integration/functions/mlcontext/FrameTest.java
+++ b/src/test/java/org/apache/sysml/test/integration/functions/mlcontext/FrameTest.java
@@ -35,17 +35,17 @@ import org.apache.spark.sql.DataFrame;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SQLContext;
import org.apache.spark.sql.types.StructType;
-import org.junit.Assert;
-import org.junit.Test;
import org.apache.sysml.api.DMLException;
import org.apache.sysml.api.DMLScript;
import org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM;
import org.apache.sysml.api.MLContext;
+import org.apache.sysml.api.MLContextProxy;
import org.apache.sysml.api.MLOutput;
-import org.apache.sysml.parser.Expression.ValueType;
import org.apache.sysml.parser.DataExpression;
+import org.apache.sysml.parser.Expression.ValueType;
import org.apache.sysml.parser.ParseException;
import org.apache.sysml.runtime.DMLRuntimeException;
+import org.apache.sysml.runtime.controlprogram.context.SparkExecutionContext;
import org.apache.sysml.runtime.instructions.spark.utils.FrameRDDConverterUtils;
import org.apache.sysml.runtime.instructions.spark.utils.FrameRDDConverterUtils.LongFrameToLongWritableFrameFunction;
import org.apache.sysml.runtime.matrix.MatrixCharacteristics;
@@ -58,6 +58,8 @@ import org.apache.sysml.runtime.util.UtilFunctions;
import org.apache.sysml.test.integration.AutomatedTestBase;
import org.apache.sysml.test.integration.TestConfiguration;
import org.apache.sysml.test.utils.TestUtils;
+import org.junit.Assert;
+import org.junit.Test;
public class FrameTest extends AutomatedTestBase
@@ -334,6 +336,12 @@ public class FrameTest extends AutomatedTestBase
finally {
DMLScript.rtplatform = oldRT;
DMLScript.USE_LOCAL_SPARK_CONFIG = oldConfig;
+
+ if (sc != null) {
+ sc.stop();
+ }
+ SparkExecutionContext.resetSparkContextStatic();
+ MLContextProxy.setActive(false);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/0f243b8f/src/test/java/org/apache/sysml/test/integration/functions/mlcontext/GNMFTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/sysml/test/integration/functions/mlcontext/GNMFTest.java b/src/test/java/org/apache/sysml/test/integration/functions/mlcontext/GNMFTest.java
index 7b68065..6ac110f 100644
--- a/src/test/java/org/apache/sysml/test/integration/functions/mlcontext/GNMFTest.java
+++ b/src/test/java/org/apache/sysml/test/integration/functions/mlcontext/GNMFTest.java
@@ -30,19 +30,20 @@ import org.apache.spark.SparkContext;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.function.Function;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.apache.spark.mllib.linalg.distributed.CoordinateMatrix;
+import org.apache.spark.mllib.linalg.distributed.MatrixEntry;
import org.apache.sysml.api.DMLException;
import org.apache.sysml.api.DMLScript;
import org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM;
import org.apache.sysml.api.MLContext;
+import org.apache.sysml.api.MLContextProxy;
import org.apache.sysml.api.MLOutput;
import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.parser.ParseException;
import org.apache.sysml.runtime.DMLRuntimeException;
+import org.apache.sysml.runtime.controlprogram.context.SparkExecutionContext;
+import org.apache.sysml.runtime.instructions.spark.utils.RDDConverterUtils;
+import org.apache.sysml.runtime.instructions.spark.utils.RDDConverterUtilsExt;
import org.apache.sysml.runtime.matrix.MatrixCharacteristics;
import org.apache.sysml.runtime.matrix.data.MatrixBlock;
import org.apache.sysml.runtime.matrix.data.MatrixIndexes;
@@ -50,10 +51,11 @@ import org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex;
import org.apache.sysml.runtime.util.MapReduceTool;
import org.apache.sysml.test.integration.AutomatedTestBase;
import org.apache.sysml.test.utils.TestUtils;
-import org.apache.sysml.runtime.instructions.spark.utils.RDDConverterUtils;
-import org.apache.sysml.runtime.instructions.spark.utils.RDDConverterUtilsExt;
-import org.apache.spark.mllib.linalg.distributed.MatrixEntry;
-import org.apache.spark.mllib.linalg.distributed.CoordinateMatrix;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
@RunWith(value = Parameterized.class)
public class GNMFTest extends AutomatedTestBase
@@ -142,12 +144,14 @@ public class GNMFTest extends AutomatedTestBase
DMLScript.USE_LOCAL_SPARK_CONFIG = true;
RUNTIME_PLATFORM oldRT = DMLScript.rtplatform;
+ MLContext mlCtx = null;
+ SparkContext sc = null;
try
{
DMLScript.rtplatform = RUNTIME_PLATFORM.HYBRID_SPARK;
- MLContext mlCtx = getMLContextForTesting();
- SparkContext sc = mlCtx.getSparkContext();
+ mlCtx = getMLContextForTesting();
+ sc = mlCtx.getSparkContext();
mlCtx.reset(true); // Cleanup config to ensure future MLContext testcases have correct 'cp.parallel.matrixmult'
// Read two matrices through RDD and one through HDFS
@@ -229,6 +233,12 @@ public class GNMFTest extends AutomatedTestBase
finally {
DMLScript.rtplatform = oldRT;
DMLScript.USE_LOCAL_SPARK_CONFIG = oldConfig;
+
+ if (sc != null) {
+ sc.stop();
+ }
+ SparkExecutionContext.resetSparkContextStatic();
+ MLContextProxy.setActive(false);
}
}