Skip to content

Commit 0736c68

Browse files
committed
[SYSTEMDS-3877] Docker cleanup
This commit fixes three bugs in the new testing image. 1. The seal library install path, to be included in the library path 2. The locale specification to US English UTF-8, to allow string comparison of Hadoop read files, without casting from 16 to 8. Furthermore, the commit does a few maintainable cleanups in the testing to reduce verbose logging of our test cases, and allow non-buffered writing of cloud running tests, to enable easy live tracking of GitHub action tests. Closes #2335
1 parent 9c96e1c commit 0736c68

File tree

7 files changed

+59
-20
lines changed

7 files changed

+59
-20
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,6 @@ scripts/resource/output
154154
# docker tests
155155
docker/mountFolder/*.bin
156156
docker/mountFolder/*.bin.mtd
157+
158+
SEAL-*/
159+

docker/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ Test your testing image locally by running the following command:
138138
```bash
139139
docker run \
140140
-v $(pwd):/github/workspace \
141+
-v $HOME/.m2/repository:/root/.m2/repository \
141142
apache/systemds:testing-latest \
142143
org.apache.sysds.test.component.**
143144
```

docker/entrypoint.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,22 @@ cd /github/workspace
2929
export MAVEN_OPTS="-Xmx512m"
3030

3131
log="/tmp/sysdstest.log"
32-
mvn -ntp -B test-compile 2>&1 | grep -E "BUILD|Total time:|---|Building SystemDS"
32+
mvn -ntp -B test-compile 2>&1 | stdbuf -oL grep -E "BUILD|Total time:|---|Building SystemDS"
3333
mvn -ntp -B test -D maven.test.skip=false -D automatedtestbase.outputbuffering=true -D test=$1 2>&1 \
34-
| grep -v "already exists in destination." \
35-
| grep -v 'WARNING: Using incubator modules' | tee $log
34+
| stdbuf -oL grep -Ev "already exists in destination.|Using incubator" \
35+
| tee $log
3636

37-
# Merge Federated test runs.
38-
[ -f target/jacoco.exec ] && mv target/jacoco.exec target/jacoco_main.exec
39-
mvn -ntp -B jacoco:merge
40-
41-
# Merge Federated test runs.
42-
[ -f target/jacoco.exec ] && mv target/jacoco.exec target/jacoco_main.exec
43-
mvn -ntp -B jacoco:merge
4437

4538
grep_args="SUCCESS"
4639
grepvals="$( tail -n 100 $log | grep $grep_args)"
4740

4841
if [[ $grepvals == *"SUCCESS"* ]]; then
42+
# Merge Federated test runs.
43+
# if merged jacoco exist temporarily rename to not overwrite.
44+
[ -f target/jacoco.exec ] && mv target/jacoco.exec target/jacoco_main.exec
45+
# merge jacoco files.
46+
mvn -ntp -B jacoco:merge 2>&1 | stdbuf -oL grep -E "jacoco"
47+
4948
exit 0
5049
else
5150
exit 1

docker/testsysds.Dockerfile

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#
2020
#-------------------------------------------------------------
2121
# Stage 1: Build SEAL
22-
FROM debian:bullseye-slim@sha256:b5f9bc44bdfbd9d551dfdd432607cbc6bb5d9d6dea726a1191797d7749166973 AS seal-build
22+
FROM ubuntu:noble@sha256:728785b59223d755e3e5c5af178fab1be7031f3522c5ccd7a0b32b80d8248123 AS seal-build
2323

2424
RUN apt-get update && apt-get install -y --no-install-recommends \
2525
build-essential \
@@ -40,16 +40,24 @@ RUN wget -qO- https://github.com/microsoft/SEAL/archive/refs/tags/v3.7.0.tar.gz
4040
&& cmake --install build --prefix /seal-install
4141

4242
# Stage 2: Final image with R, JDK, Maven, SEAL
43-
FROM debian:bullseye-slim@sha256:b5f9bc44bdfbd9d551dfdd432607cbc6bb5d9d6dea726a1191797d7749166973
43+
FROM ubuntu:noble@sha256:728785b59223d755e3e5c5af178fab1be7031f3522c5ccd7a0b32b80d8248123
4444

4545
WORKDIR /usr/src/
4646
ENV MAVEN_VERSION=3.9.9
4747
ENV MAVEN_HOME=/usr/lib/mvn
4848

49+
ENV LANGUAGE=en_US:en
50+
ENV LC_ALL=en_US.UTF-8
51+
ENV LANG=en_US.UTF-8
4952
ENV JAVA_HOME=/usr/lib/jvm/jdk-17.0.15+6
5053
ENV PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH
5154

52-
RUN apt-get update && apt-get install -y --no-install-recommends \
55+
RUN apt-get update && apt-get install -y locales \
56+
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
57+
&& locale-gen \
58+
&& update-locale LANG=en_US.UTF-8
59+
60+
RUN apt-get install -y --no-install-recommends \
5361
r-base \
5462
wget \
5563
cmake \
@@ -78,8 +86,26 @@ COPY ./src/test/scripts/installDependencies.R installDependencies.R
7886
RUN Rscript installDependencies.R \
7987
&& rm -f installDependencies.R
8088

89+
ENV HADOOP_VERSION=3.3.6
90+
ENV HADOOP_HOME=/opt/hadoop
91+
ENV LD_LIBRARY_PATH=/opt/hadoop/lib/native
92+
ENV HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib/native"
93+
94+
RUN mkdir -p $HADOOP_HOME/lib/native \
95+
&& wget -q https://downloads.apache.org/hadoop/common/hadoop-${HADOOP_VERSION}/hadoop-${HADOOP_VERSION}.tar.gz && \
96+
tar --strip-components=2 -xzf hadoop-${HADOOP_VERSION}.tar.gz \
97+
hadoop-${HADOOP_VERSION}/lib/native && \
98+
mv native/libhadoop.so.1.0.0 /opt/hadoop/lib/native && \
99+
mv native/libhadoop.so /opt/hadoop/lib/native && \
100+
rm hadoop-${HADOOP_VERSION}.tar.gz && \
101+
rm -rf native
102+
81103
# Copy SEAL
82-
COPY --from=seal-build /seal-install /usr/local
104+
COPY --from=seal-build /seal-install/lib/ /usr/local/lib/
105+
COPY --from=seal-build /seal-install/include/ /usr/local/include/
106+
107+
ENV LD_LIBRARY_PATH=/opt/hadoop/lib/native;/usr/local/lib/
108+
83109

84110
# Finally copy the entrypoint script
85111
# This is last to enable quick updates to the script after initial local build.

src/main/cpp/build_HE.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#
2121
#-------------------------------------------------------------
2222

23-
echo "Build Homomorphic Encryption Liberary: "
23+
echo "Build Homomorphic Encryption Library: "
2424

2525
# compile HE
2626
cmake he/ -B HE -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++
@@ -29,4 +29,4 @@ rm -R HE
2929

3030
echo ""
3131

32-
echo "Sucessfull install of Homomorphic Encryption Liberary SEAL"
32+
echo "Successful install of Homomorphic Encryption Library SEAL"

src/test/java/org/apache/sysds/test/TestUtils.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,15 +1760,25 @@ public static HashMap<CellIndex, Double> convert2DDoubleArrayToHashMap(double[][
17601760
}
17611761

17621762
public static double[][] convertHashMapToDoubleArray(HashMap <CellIndex, Double> matrix) {
1763+
if(matrix.isEmpty()){
1764+
LOG.error("converting empty hashMap");
1765+
return new double[0][0];
1766+
}
17631767
int max_rows = -1, max_cols= -1;
1768+
17641769
for(CellIndex ix : matrix.keySet()) {
17651770
max_rows = Math.max(max_rows, ix.row);
17661771
max_cols = Math.max(max_cols, ix.column);
17671772
}
1773+
17681774
return convertHashMapToDoubleArray(matrix, max_rows, max_cols);
17691775
}
17701776

17711777
public static double[][] convertHashMapToDoubleArray(HashMap<CellIndex, Double> matrix, int rows, int cols) {
1778+
if(rows <= -1 || cols <= -1){
1779+
LOG.error("converting negative size hashmap rows: " + rows + " cols: " + cols);
1780+
return new double[0][0];
1781+
}
17721782
double [][] ret_arr = new double[rows][cols];
17731783
for(Entry<CellIndex, Double> e : matrix.entrySet()) {
17741784
int i = e.getKey().row-1;

src/test/java/org/apache/sysds/test/functions/transform/TransformCSVFrameEncodeReadTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,16 @@ private void runTransformTest( ExecMode rt, String ofmt, boolean subset, boolean
148148
String[] fromDisk = DataConverter.toString(fb2).split("\n");
149149
String[] printed = stdOut.split("\n");
150150
boolean equal = true;
151-
String err = "";
151+
StringBuilder err = new StringBuilder();
152152
for(int i = 0; i < fromDisk.length; i++){
153-
if(! fromDisk[i].equals(printed[i])){
154-
err += "\n not equal: \n"+ (fromDisk[i] + "\n" + printed[i]);
153+
if(! fromDisk[i].strip().equals(printed[i].strip())){
154+
err.append("\n not equal: \n'"+ (fromDisk[i] + "'\n'" + printed[i] + "'"));
155155
equal = false;
156156
}
157157

158158
}
159159
if(!equal)
160-
fail(err);
160+
fail(err.toString());
161161

162162
}
163163
catch(Exception ex) {

0 commit comments

Comments
 (0)