Skip to content

Commit 5f390b3

Browse files
committed
[MINOR] Fix robustness parameter server utils and tests
1 parent 4ad40e0 commit 5f390b3

File tree

8 files changed

+14
-12
lines changed

8 files changed

+14
-12
lines changed

src/main/java/org/apache/sysds/hops/rewrite/HopRewriteUtils.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
package org.apache.sysds.hops.rewrite;
2121

2222
import org.apache.commons.lang3.ArrayUtils;
23-
import org.apache.commons.logging.Log;
24-
import org.apache.commons.logging.LogFactory;
2523
import org.apache.sysds.api.DMLScript;
2624
import org.apache.sysds.common.Opcodes;
2725
import org.apache.sysds.common.Types.DataType;
@@ -90,7 +88,6 @@
9088
import java.util.List;
9189

9290
public class HopRewriteUtils {
93-
private static final Log LOG = LogFactory.getLog(HopRewriteUtils.class.getName());
9491

9592
public static boolean isValueTypeCast( OpOp1 op ) {
9693
return op == OpOp1.CAST_AS_BOOLEAN
@@ -1712,7 +1709,6 @@ public static boolean knownParamservFunctions(Hop hop, DMLProgram prog) {
17121709
// If the function keys are incorrect this exception is caught for robustness in error messages for users.
17131710
// Intensionally only catching the exception!
17141711
// For debugging if for some reason the error we encountered was something else we LOG the error.
1715-
LOG.error(ex);
17161712
return false;
17171713
}
17181714
}

src/main/java/org/apache/sysds/parser/DMLProgram.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,14 @@ public FunctionDictionary<FunctionStatementBlock> createNamespace(String namespa
8989
*/
9090
public FunctionStatementBlock getFunctionStatementBlock(String fkey) {
9191
String[] tmp = splitFunctionKey(fkey);
92-
return getFunctionStatementBlock(tmp[0], tmp[1]);
92+
return tmp.length < 2 ? null :
93+
getFunctionStatementBlock(tmp[0], tmp[1]);
9394
}
9495

9596
public void removeFunctionStatementBlock(String fkey) {
9697
String[] tmp = splitFunctionKey(fkey);
97-
removeFunctionStatementBlock(tmp[0], tmp[1]);
98+
if( tmp.length == 2 )
99+
removeFunctionStatementBlock(tmp[0], tmp[1]);
98100
}
99101

100102
public FunctionStatementBlock getFunctionStatementBlock(String namespaceKey, String functionName) {

src/main/java/org/apache/sysds/runtime/controlprogram/paramserv/dp/DCLocalScheme.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public static List<MatrixBlock> partition(int k, MatrixBlock mb) {
5353
}
5454

5555
private static List<MatrixObject> doPartitioning(int k, MatrixBlock mb) {
56-
return partition(k, mb).stream().map(ParamservUtils::newMatrixObject).collect(Collectors.toList());
56+
return partition(k, mb).stream()
57+
.map(m -> ParamservUtils.newMatrixObject(m, false)).collect(Collectors.toList());
5758
}
5859

5960
@Override

src/main/java/org/apache/sysds/runtime/controlprogram/paramserv/dp/DRLocalScheme.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ private static List<MatrixBlock> partition(int k, MatrixBlock mb, MatrixBlock pe
4949
}
5050

5151
private static List<MatrixObject> internalDoPartitioning(int k, MatrixBlock mb, MatrixBlock permutation) {
52-
return partition(k, mb, permutation).stream().map(ParamservUtils::newMatrixObject).collect(Collectors.toList());
52+
return partition(k, mb, permutation).stream()
53+
.map(m -> ParamservUtils.newMatrixObject(m, false)).collect(Collectors.toList());
5354
}
5455

5556
@Override

src/main/java/org/apache/sysds/runtime/controlprogram/paramserv/dp/ORLocalScheme.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ public static List<MatrixBlock> partition(int k, MatrixBlock mb, List<MatrixBloc
4646
}
4747

4848
private static List<MatrixObject> doPartitioning(int k, MatrixBlock mb, List<MatrixBlock> permutations) {
49-
return partition(k, mb, permutations).stream().map(ParamservUtils::newMatrixObject).collect(Collectors.toList());
49+
return partition(k, mb, permutations).stream()
50+
.map(m -> ParamservUtils.newMatrixObject(m, false)).collect(Collectors.toList());
5051
}
5152

5253
@Override

src/test/java/org/apache/sysds/test/functions/frame/FrameEqualTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private void runComparisonTest(Types.ValueType[] schema1, Types.ValueType[] sche
134134
Types.ExecMode platformOld = setExecMode(et);
135135
boolean oldFlag = OptimizerUtils.ALLOW_ALGEBRAIC_SIMPLIFICATION;
136136
boolean sparkConfigOld = DMLScript.USE_LOCAL_SPARK_CONFIG;
137-
setOutputBuffering(true);
137+
//setOutputBuffering(true);
138138
try {
139139
getAndLoadTestConfiguration(TEST_NAME);
140140

src/test/java/org/apache/sysds/test/functions/paramserv/ParamservSyntaxTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,5 @@ private void runDMLTest(String testname, boolean exceptionExpected, Class<?> exc
9898
programArgs = new String[] { "-explain" };
9999
fullDMLScriptName = HOME + testname + ".dml";
100100
runTest(true, exceptionExpected, exceptionClass, errmsg, -1);
101-
setOutputBuffering(false);
102101
}
103102
}

src/test/java/org/apache/sysds/test/functions/paramserv/SparkDataPartitionerTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public class SparkDataPartitionerTest extends BaseDataPartitionerTest {
4949

5050
private Map<Integer, Tuple2<MatrixBlock, MatrixBlock>> doPartitioning(Statement.PSScheme scheme) {
5151
MatrixBlock[] mbs = generateData();
52-
return SparkParamservUtils.doPartitionOnSpark(_sec, ParamservUtils.newMatrixObject(mbs[0]), ParamservUtils.newMatrixObject(mbs[1]), scheme, WORKER_NUM).collectAsMap();
52+
return SparkParamservUtils.doPartitionOnSpark(_sec,
53+
ParamservUtils.newMatrixObject(mbs[0], false),
54+
ParamservUtils.newMatrixObject(mbs[1]), scheme, WORKER_NUM).collectAsMap();
5355
}
5456

5557
@Test

0 commit comments

Comments
 (0)