Skip to content

Commit 4818084

Browse files
authored
Fixed artifacts handling + added tests logs aggregation (#445)
* Snapshot packages are placed into http://redismodules.s3.amazonaws.com/redisai/snapshots. Private branches (i.e., non-master) are also supported, just need to enable deploy-snapshot in config.yml to fire on on-any-branch rather than just on-master. * Release packages are placed into http://redismodules.s3.amazonaws.com/redisai, and it's going to be crowded in there, so we may want to consider putting each version into its own directory. * `BB` in-source breakpoints are now supported (in `DEBUG=1` builds): put `BB;` inside the code and it will stop if you're running under gdb. * Tests results in CircleCI are now aggregated as artifacts.
1 parent 5c7813e commit 4818084

File tree

11 files changed

+124
-48
lines changed

11 files changed

+124
-48
lines changed

.circleci/config.yml

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,17 @@ commands:
4646
no_output_timeout: 20m
4747
- run:
4848
name: Package
49-
command: make -C opt pack SHOW=1
49+
command: |
50+
make -C opt pack SHOW=1
51+
(cd bin/artifacts; tar -cf snapshots-<<parameters.platform>>.tar snapshots/)
5052
- persist_to_workspace:
5153
root: bin/
5254
paths:
5355
- artifacts/*.zip
5456
- artifacts/*.tgz
57+
- artifacts/*.tar
58+
# - artifacts/shapshots/*.zip
59+
# - artifacts/shapshots/*.tgz
5560
- store_artifacts:
5661
path: test/logs
5762

@@ -71,16 +76,27 @@ commands:
7176
name: Build for platform
7277
command: |
7378
docker login -u redisfab -p $DOCKER_REDISFAB_PWD
74-
cd opt/build/docker
79+
pushd opt/build/docker
7580
#@@ make build publish $(./version-params) CPU=1 OSNICK=<<parameters.platform>> X64=1 ARTIFACTS=1 TEST=1 VERBOSE=1
7681
make build publish $(./version-params) CPU=1 OSNICK=<<parameters.platform>> X64=1 ARTIFACTS=1 VERBOSE=1
7782
make build publish $(./version-params) GPU=1 OSNICK=<<parameters.platform>> X64=1 ARTIFACTS=1 VERBOSE=1
83+
popd > /dev/null
84+
logstar=bin/artifacts/tests-logs-cpu.tgz
85+
logsdir=tests/logs/cpu
86+
mkdir -p $logsdir
87+
if [[ -e $logstar ]]; then tar -C $logsdir -xzf $logstar; fi
88+
(cd bin/artifacts; tar -cf snapshots-<<parameters.platform>>.tar snapshots/)
7889
no_output_timeout: 40m
7990
- persist_to_workspace:
8091
root: bin/
8192
paths:
8293
- artifacts/*.zip
8394
- artifacts/*.tgz
95+
- artifacts/*.tar
96+
# - artifacts/shapshots/*.zip
97+
# - artifacts/shapshots/*.tgz
98+
- store_artifacts:
99+
path: test/logs
84100

85101
deploy-steps:
86102
parameters:
@@ -202,11 +218,11 @@ jobs:
202218
docker run --gpus all -v $HOME/tests:/build/test/logs -it --rm redisai-gpu:latest-x64-bionic-test
203219
no_output_timeout: 40m
204220
- store_artifacts:
205-
path: tests
221+
path: test/log
206222

207223
deploy-artifacts:
208224
parameters:
209-
package:
225+
location:
210226
type: string
211227
docker:
212228
- image: redisfab/rmbuilder:6.0.5-x64-buster
@@ -216,8 +232,42 @@ jobs:
216232
- run:
217233
name: Deploy to S3
218234
command: |
219-
cd workspace
220-
aws s3 cp artifacts/ s3://redismodules/$PACKAGE_NAME/ --acl public-read --recursive --exclude "*" --include "*.zip" --include "*.tgz"
235+
cd "workspace/artifacts/<<parameters.location>>"
236+
for f in *.zip snapshot/*.tgz; do
237+
aws s3 cp $f s3://redismodules/$PACKAGE_NAME/<<parameters.location>>/ --acl public-read
238+
done
239+
240+
deploy-snapshot:
241+
docker:
242+
- image: redisfab/rmbuilder:6.0.5-x64-buster
243+
steps:
244+
- attach_workspace:
245+
at: workspace
246+
- run:
247+
name: Deploy Snapshots to S3
248+
command: |
249+
cd workspace/artifacts
250+
for f in snapshots-*.tar; do
251+
tar xf $f
252+
done
253+
cd snapshots
254+
for f in *.zip *.tgz; do
255+
aws s3 cp --no-progress $f s3://redismodules/$PACKAGE_NAME/snapshots/ --acl public-read
256+
done
257+
258+
deploy-release:
259+
docker:
260+
- image: redisfab/rmbuilder:6.0.5-x64-buster
261+
steps:
262+
- attach_workspace:
263+
at: workspace
264+
- run:
265+
name: Deploy Releases to S3
266+
command: |
267+
cd workspace/artifacts
268+
for f in *.zip *.tgz; do
269+
aws s3 cp --no-progress $f s3://redismodules/$PACKAGE_NAME/ --acl public-read
270+
done
221271
222272
223273
on-any-branch: &on-any-branch
@@ -296,14 +346,10 @@ workflows:
296346
- build-multiarch-docker:
297347
<<: *never # temporarily disabled
298348
# <<: *on-version-tags
299-
- deploy-artifacts:
300-
name: deploy-branch
301-
package: branch
349+
- deploy-snapshot:
302350
<<: *after-platform-builds
303-
<<: *on-any-branch
304-
- deploy-artifacts:
305-
name: deploy-release
306-
package: release
351+
<<: *on-master
352+
- deploy-release:
307353
<<: *after-platform-builds
308354
<<: *on-version-tags
309355

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
3939
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
4040

4141
# Add -fno-omit-frame-pointer to avoid seeing incomplete stack traces
42-
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -ggdb -fno-omit-frame-pointer -DVALGRIND")
43-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -ggdb -fno-omit-frame-pointer -DVALGRIND")
42+
set(CMAKE_COMMON_FLAGS_DEBUG "-g -ggdb -fno-omit-frame-pointer -D_DEBUG -DVALGRIND -include \
43+
${CMAKE_CURRENT_SOURCE_DIR}/src/common.h -I${CMAKE_CURRENT_SOURCE_DIR}/opt")
44+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_COMMON_FLAGS_DEBUG}")
45+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_COMMON_FLAGS_DEBUG}")
4446

4547
#----------------------------------------------------------------------------------------------
4648

Dockerfile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ COPY --from=redis /usr/local/ /usr/local/
3131
COPY ./opt/ opt/
3232
COPY ./test/test_requirements.txt test/
3333

34-
RUN ./opt/readies/bin/getpy3
34+
RUN PIP=19.3.1 FORCE=1 ./opt/readies/bin/getpy3
3535
RUN ./opt/system-setup.py
3636

3737
ARG DEPS_ARGS=""
@@ -40,17 +40,24 @@ RUN if [ "$DEPS_ARGS" = "" ]; then ./get_deps.sh cpu; else env $DEPS_ARGS ./get_
4040

4141
ARG BUILD_ARGS=""
4242
ADD ./ /build
43-
RUN set -e ;\
43+
RUN bash -c "set -e ;\
4444
. ./opt/readies/bin/sourced ./profile.d ;\
45-
make -C opt build $BUILD_ARGS SHOW=1
45+
make -C opt build $BUILD_ARGS SHOW=1"
4646

4747
ARG PACK
4848
ARG TEST
4949

5050
RUN mkdir -p bin/artifacts
51-
RUN if [ "$PACK" = "1" ]; then make -C opt pack; fi
51+
RUN set -e ;\
52+
if [ "$PACK" = "1" ]; then make -C opt pack; fi
5253

53-
RUN if [ "$TEST" = "1" ]; then TEST= make -C opt test $BUILD_ARGS NO_LFS=1; fi
54+
RUN set -e ;\
55+
if [ "$TEST" = "1" ]; then \
56+
TEST= make -C opt test $BUILD_ARGS NO_LFS=1 ;\
57+
if [[ -d test/logs ]]; then \
58+
tar -C test/logs -czf bin/artifacts/test-logs-cpu.tgz . ;\
59+
fi ;\
60+
fi
5461

5562
#----------------------------------------------------------------------------------------------
5663
FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK}

Dockerfile.gpu

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ ARG REDIS_VER=6.0.5
55
# OSNICK=bionic|centos7|centos6
66
ARG OSNICK=bionic
77

8-
# ARCH=x64|arm64v8|arm32v7
9-
ARG ARCH=x64
10-
118
# OS=ubuntu18.04|ubuntu16.04|centos7
129
ARG OS=ubuntu18.04
1310

11+
# ARCH=x64|arm64v8|arm32v7
12+
ARG ARCH=x64
13+
1414
ARG CUDA_VER=10.1-cudnn7
1515

1616
ARG PACK=0
@@ -22,10 +22,11 @@ FROM nvidia/cuda:${CUDA_VER}-devel-${OS} AS builder
2222

2323
ARG OSNICK
2424
ARG OS
25+
ARG ARCH
2526
ARG REDIS_VER
2627
ARG CUDA_VER
2728

28-
RUN echo "Building for ${OSNICK} (${OS}) [with Redis ${REDIS_VER}]"
29+
RUN echo "Building for ${OSNICK} (${OS}) for ${ARCH} [with Redis ${REDIS_VER}]"
2930

3031
ENV NVIDIA_VISIBLE_DEVICES all
3132
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
@@ -36,7 +37,7 @@ COPY --from=redis /usr/local/ /usr/local/
3637
COPY ./opt/ opt/
3738
COPY ./test/test_requirements.txt test/
3839

39-
RUN ./opt/readies/bin/getpy3
40+
RUN PIP=19.3.1 FORCE=1 ./opt/readies/bin/getpy3
4041
RUN ./opt/system-setup.py
4142

4243
ARG DEPS_ARGS=""
@@ -45,17 +46,24 @@ RUN if [ "$DEPS_ARGS" = "" ]; then ./get_deps.sh gpu; else env $DEPS_ARGS ./get_
4546

4647
ARG BUILD_ARGS=""
4748
ADD ./ /build
48-
RUN set -e ;\
49+
RUN bash -c "set -e ;\
4950
. ./opt/readies/bin/sourced ./profile.d ;\
50-
make -C opt build GPU=1 $BUILD_ARGS SHOW=1
51+
make -C opt build GPU=1 $BUILD_ARGS SHOW=1"
5152

5253
ARG PACK
5354
ARG TEST
5455

5556
RUN mkdir -p bin/artifacts
56-
RUN if [ "$PACK" = "1" ]; then make -C opt pack GPU=1; fi
57+
RUN set -e ;\
58+
if [ "$PACK" = "1" ]; then make -C opt pack GPU=1; fi
5759

58-
RUN if [ "$TEST" = "1" ]; then TEST= make -C opt test GPU=1 $BUILD_ARGS NO_LFS=1; fi
60+
RUN set -e ;\
61+
if [ "$TEST" = "1" ]; then \
62+
TEST= make -C opt test GPU=1 $BUILD_ARGS NO_LFS=1 ;\
63+
if [[ -d test/logs ]]; then \
64+
tar -C test/logs -czf bin/artifacts/test-logs-gpu.tgz . ;\
65+
fi ;\
66+
fi
5967

6068
#----------------------------------------------------------------------------------------------
6169
FROM nvidia/cuda:${CUDA_VER}-runtime-${OS}

opt/pack.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ pack_ramp() {
112112
>&2 cat /tmp/ramp.err
113113
exit 1
114114
fi
115-
116-
echo "Done."
117115
}
118116

119117
#----------------------------------------------------------------------------------------------
@@ -130,13 +128,13 @@ pack_deps() {
130128
local backends_prefix_dir=""
131129

132130
if [[ $depname == all ]]; then
133-
local backens_dir=.
131+
local backends_dir=.
134132
else
135-
local backens_dir=${PRODUCT}_$depname
133+
local backends_dir=${PRODUCT}_$depname
136134
fi
137135

138136
cd $INSTALL_DIR/backends
139-
{ find $backens_dir -name "*.so*" | \
137+
{ find $backends_dir -name "*.so*" | \
140138
xargs tar -c --sort=name --owner=root:0 --group=root:0 --mtime='UTC 1970-01-01' --transform "s,^,$backends_prefix_dir," 2>> /tmp/pack.err | \
141139
gzip -n - > $tar_path ; E=$?; } || true
142140
sha256sum $tar_path | gawk '{print $1}' > $tar_path.sha256

opt/system-setup.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,29 @@ def debian_compat(self):
3131
self.install("gawk")
3232
self.install("build-essential cmake")
3333
self.install("python3-regex")
34-
self.install("python3-venv python3-psutil python3-networkx python3-numpy") # python3-skimage
34+
self.install("python3-psutil python3-networkx python3-numpy") # python3-skimage
3535
self.install_git_lfs_on_linux()
3636

3737
def redhat_compat(self):
3838
self.install("redhat-lsb-core")
3939
self.run("%s/readies/bin/enable-utf8" % HERE)
40-
40+
4141
self.group_install("'Development Tools'")
4242
self.install("cmake3")
43-
self.run("ln -s `command -v cmake3` /usr/local/bin/cmake")
44-
43+
self.run("ln -sf `command -v cmake3` /usr/local/bin/cmake")
44+
4545
self.install("centos-release-scl")
4646
self.install("devtoolset-8")
4747
self.run("cp /opt/rh/devtoolset-8/enable /etc/profile.d/scl-devtoolset-8.sh")
4848
paella.mkdir_p("%s/profile.d" % ROOT)
4949
self.run("cp /opt/rh/devtoolset-8/enable %s/profile.d/scl-devtoolset-8.sh" % ROOT)
5050

51+
self.run("""
52+
dir=$(mktemp -d /tmp/tar.XXXXXX)
53+
(cd $dir; wget -q -O tar.tgz http://redismodules.s3.amazonaws.com/gnu/gnu-tar-1.32-x64-centos7.tgz; tar -xzf tar.tgz -C /; )
54+
rm -rf $dir
55+
""")
56+
5157
if not self.dist == "amzn":
5258
self.install("epel-release")
5359
self.install("python3-devel libaec-devel")
@@ -62,8 +68,8 @@ def redhat_compat(self):
6268
def fedora(self):
6369
self.group_install("'Development Tools'")
6470
self.install("cmake")
65-
self.run("ln -s `command -v cmake3` /usr/local/bin/cmake")
66-
self.install("python3-venv python3-psutil python3-networkx")
71+
self.run("ln -sf `command -v cmake3` /usr/local/bin/cmake")
72+
self.install("python3 python3-psutil python3-networkx")
6773
self.install_git_lfs_on_linux()
6874

6975
def macosx(self):

src/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
if (CMAKE_BUILD_TYPE STREQUAL Debug)
2+
SET(DEBUG_SRC "${CMAKE_CURRENT_SOURCE_DIR}/../opt/readies/cetara/diag/gdb.c")
3+
endif()
4+
15
ADD_LIBRARY(redisai_obj OBJECT
26
util/dict.c
37
util/queue.c
@@ -19,7 +23,8 @@ ADD_LIBRARY(redisai_obj OBJECT
1923
rmutil/args.c
2024
rmutil/heap.c
2125
rmutil/priority_queue.c
22-
rmutil/vector.c run_info.c)
26+
rmutil/vector.c run_info.c
27+
${DEBUG_SRC})
2328

2429
IF(BUILD_TF)
2530
ADD_LIBRARY(redisai_tensorflow_obj OBJECT

src/common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
#if defined(DEBUG) || defined(_DEBUG)
3+
#include "readies/cetara/diag/gdb.h"
4+
#endif

test/includes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
COV = os.environ.get("COV") != "0" and os.environ.get("COV") != "0"
2525
DEVICE = os.environ.get('DEVICE', 'CPU').upper().encode('utf-8', 'ignore').decode('utf-8')
2626
VALGRIND = os.environ.get("VALGRIND") == "1"
27-
print(f"Running tests on {DEVICE}\n")
28-
print(f"Using a max of {MAX_ITERATIONS} iterations per test\n")
27+
print("Running tests on {}\n".format(DEVICE))
28+
print("Using a max of {} iterations per test\n".format(MAX_ITERATIONS))
2929
# change this to make inference tests longer
3030
MAX_TRANSACTIONS=100
3131

0 commit comments

Comments
 (0)