Skip to content

Fixed artifacts handling + added tests logs aggregation #445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 59 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@ commands:
no_output_timeout: 20m
- run:
name: Package
command: make -C opt pack SHOW=1
command: |
make -C opt pack SHOW=1
(cd bin/artifacts; tar -cf snapshots-<<parameters.platform>>.tar snapshots/)
- persist_to_workspace:
root: bin/
paths:
- artifacts/*.zip
- artifacts/*.tgz
- artifacts/*.tar
# - artifacts/shapshots/*.zip
# - artifacts/shapshots/*.tgz
- store_artifacts:
path: test/logs

Expand All @@ -71,16 +76,27 @@ commands:
name: Build for platform
command: |
docker login -u redisfab -p $DOCKER_REDISFAB_PWD
cd opt/build/docker
pushd opt/build/docker
#@@ make build publish $(./version-params) CPU=1 OSNICK=<<parameters.platform>> X64=1 ARTIFACTS=1 TEST=1 VERBOSE=1
make build publish $(./version-params) CPU=1 OSNICK=<<parameters.platform>> X64=1 ARTIFACTS=1 VERBOSE=1
make build publish $(./version-params) GPU=1 OSNICK=<<parameters.platform>> X64=1 ARTIFACTS=1 VERBOSE=1
popd > /dev/null
logstar=bin/artifacts/tests-logs-cpu.tgz
logsdir=tests/logs/cpu
mkdir -p $logsdir
if [[ -e $logstar ]]; then tar -C $logsdir -xzf $logstar; fi
(cd bin/artifacts; tar -cf snapshots-<<parameters.platform>>.tar snapshots/)
no_output_timeout: 40m
- persist_to_workspace:
root: bin/
paths:
- artifacts/*.zip
- artifacts/*.tgz
- artifacts/*.tar
# - artifacts/shapshots/*.zip
# - artifacts/shapshots/*.tgz
- store_artifacts:
path: test/logs

deploy-steps:
parameters:
Expand Down Expand Up @@ -202,11 +218,11 @@ jobs:
docker run --gpus all -v $HOME/tests:/build/test/logs -it --rm redisai-gpu:latest-x64-bionic-test
no_output_timeout: 40m
- store_artifacts:
path: tests
path: test/log

deploy-artifacts:
parameters:
package:
location:
type: string
docker:
- image: redisfab/rmbuilder:6.0.5-x64-buster
Expand All @@ -216,8 +232,42 @@ jobs:
- run:
name: Deploy to S3
command: |
cd workspace
aws s3 cp artifacts/ s3://redismodules/$PACKAGE_NAME/ --acl public-read --recursive --exclude "*" --include "*.zip" --include "*.tgz"
cd "workspace/artifacts/<<parameters.location>>"
for f in *.zip snapshot/*.tgz; do
aws s3 cp $f s3://redismodules/$PACKAGE_NAME/<<parameters.location>>/ --acl public-read
done

deploy-snapshot:
docker:
- image: redisfab/rmbuilder:6.0.5-x64-buster
steps:
- attach_workspace:
at: workspace
- run:
name: Deploy Snapshots to S3
command: |
cd workspace/artifacts
for f in snapshots-*.tar; do
tar xf $f
done
cd snapshots
for f in *.zip *.tgz; do
aws s3 cp --no-progress $f s3://redismodules/$PACKAGE_NAME/snapshots/ --acl public-read
done

deploy-release:
docker:
- image: redisfab/rmbuilder:6.0.5-x64-buster
steps:
- attach_workspace:
at: workspace
- run:
name: Deploy Releases to S3
command: |
cd workspace/artifacts
for f in *.zip *.tgz; do
aws s3 cp --no-progress $f s3://redismodules/$PACKAGE_NAME/ --acl public-read
done


on-any-branch: &on-any-branch
Expand Down Expand Up @@ -296,14 +346,10 @@ workflows:
- build-multiarch-docker:
<<: *never # temporarily disabled
# <<: *on-version-tags
- deploy-artifacts:
name: deploy-branch
package: branch
- deploy-snapshot:
<<: *after-platform-builds
<<: *on-any-branch
- deploy-artifacts:
name: deploy-release
package: release
<<: *on-master
- deploy-release:
<<: *after-platform-builds
<<: *on-version-tags

Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")

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

#----------------------------------------------------------------------------------------------

Expand Down
17 changes: 12 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ COPY --from=redis /usr/local/ /usr/local/
COPY ./opt/ opt/
COPY ./test/test_requirements.txt test/

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

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

ARG BUILD_ARGS=""
ADD ./ /build
RUN set -e ;\
RUN bash -c "set -e ;\
. ./opt/readies/bin/sourced ./profile.d ;\
make -C opt build $BUILD_ARGS SHOW=1
make -C opt build $BUILD_ARGS SHOW=1"

ARG PACK
ARG TEST

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

RUN if [ "$TEST" = "1" ]; then TEST= make -C opt test $BUILD_ARGS NO_LFS=1; fi
RUN set -e ;\
if [ "$TEST" = "1" ]; then \
TEST= make -C opt test $BUILD_ARGS NO_LFS=1 ;\
if [[ -d test/logs ]]; then \
tar -C test/logs -czf bin/artifacts/test-logs-cpu.tgz . ;\
fi ;\
fi

#----------------------------------------------------------------------------------------------
FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK}
Expand Down
26 changes: 17 additions & 9 deletions Dockerfile.gpu
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ ARG REDIS_VER=6.0.5
# OSNICK=bionic|centos7|centos6
ARG OSNICK=bionic

# ARCH=x64|arm64v8|arm32v7
ARG ARCH=x64

# OS=ubuntu18.04|ubuntu16.04|centos7
ARG OS=ubuntu18.04

# ARCH=x64|arm64v8|arm32v7
ARG ARCH=x64

ARG CUDA_VER=10.1-cudnn7

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

ARG OSNICK
ARG OS
ARG ARCH
ARG REDIS_VER
ARG CUDA_VER

RUN echo "Building for ${OSNICK} (${OS}) [with Redis ${REDIS_VER}]"
RUN echo "Building for ${OSNICK} (${OS}) for ${ARCH} [with Redis ${REDIS_VER}]"

ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
Expand All @@ -36,7 +37,7 @@ COPY --from=redis /usr/local/ /usr/local/
COPY ./opt/ opt/
COPY ./test/test_requirements.txt test/

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

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

ARG BUILD_ARGS=""
ADD ./ /build
RUN set -e ;\
RUN bash -c "set -e ;\
. ./opt/readies/bin/sourced ./profile.d ;\
make -C opt build GPU=1 $BUILD_ARGS SHOW=1
make -C opt build GPU=1 $BUILD_ARGS SHOW=1"

ARG PACK
ARG TEST

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

RUN if [ "$TEST" = "1" ]; then TEST= make -C opt test GPU=1 $BUILD_ARGS NO_LFS=1; fi
RUN set -e ;\
if [ "$TEST" = "1" ]; then \
TEST= make -C opt test GPU=1 $BUILD_ARGS NO_LFS=1 ;\
if [[ -d test/logs ]]; then \
tar -C test/logs -czf bin/artifacts/test-logs-gpu.tgz . ;\
fi ;\
fi

#----------------------------------------------------------------------------------------------
FROM nvidia/cuda:${CUDA_VER}-runtime-${OS}
Expand Down
8 changes: 3 additions & 5 deletions opt/pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ pack_ramp() {
>&2 cat /tmp/ramp.err
exit 1
fi

echo "Done."
}

#----------------------------------------------------------------------------------------------
Expand All @@ -130,13 +128,13 @@ pack_deps() {
local backends_prefix_dir=""

if [[ $depname == all ]]; then
local backens_dir=.
local backends_dir=.
else
local backens_dir=${PRODUCT}_$depname
local backends_dir=${PRODUCT}_$depname
fi

cd $INSTALL_DIR/backends
{ find $backens_dir -name "*.so*" | \
{ find $backends_dir -name "*.so*" | \
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 | \
gzip -n - > $tar_path ; E=$?; } || true
sha256sum $tar_path | gawk '{print $1}' > $tar_path.sha256
Expand Down
2 changes: 1 addition & 1 deletion opt/readies
18 changes: 12 additions & 6 deletions opt/system-setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,29 @@ def debian_compat(self):
self.install("gawk")
self.install("build-essential cmake")
self.install("python3-regex")
self.install("python3-venv python3-psutil python3-networkx python3-numpy") # python3-skimage
self.install("python3-psutil python3-networkx python3-numpy") # python3-skimage
self.install_git_lfs_on_linux()

def redhat_compat(self):
self.install("redhat-lsb-core")
self.run("%s/readies/bin/enable-utf8" % HERE)

self.group_install("'Development Tools'")
self.install("cmake3")
self.run("ln -s `command -v cmake3` /usr/local/bin/cmake")
self.run("ln -sf `command -v cmake3` /usr/local/bin/cmake")

self.install("centos-release-scl")
self.install("devtoolset-8")
self.run("cp /opt/rh/devtoolset-8/enable /etc/profile.d/scl-devtoolset-8.sh")
paella.mkdir_p("%s/profile.d" % ROOT)
self.run("cp /opt/rh/devtoolset-8/enable %s/profile.d/scl-devtoolset-8.sh" % ROOT)

self.run("""
dir=$(mktemp -d /tmp/tar.XXXXXX)
(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 /; )
rm -rf $dir
""")

if not self.dist == "amzn":
self.install("epel-release")
self.install("python3-devel libaec-devel")
Expand All @@ -62,8 +68,8 @@ def redhat_compat(self):
def fedora(self):
self.group_install("'Development Tools'")
self.install("cmake")
self.run("ln -s `command -v cmake3` /usr/local/bin/cmake")
self.install("python3-venv python3-psutil python3-networkx")
self.run("ln -sf `command -v cmake3` /usr/local/bin/cmake")
self.install("python3 python3-psutil python3-networkx")
self.install_git_lfs_on_linux()

def macosx(self):
Expand Down
7 changes: 6 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
if (CMAKE_BUILD_TYPE STREQUAL Debug)
SET(DEBUG_SRC "${CMAKE_CURRENT_SOURCE_DIR}/../opt/readies/cetara/diag/gdb.c")
endif()

ADD_LIBRARY(redisai_obj OBJECT
util/dict.c
util/queue.c
Expand All @@ -19,7 +23,8 @@ ADD_LIBRARY(redisai_obj OBJECT
rmutil/args.c
rmutil/heap.c
rmutil/priority_queue.c
rmutil/vector.c run_info.c)
rmutil/vector.c run_info.c
${DEBUG_SRC})

IF(BUILD_TF)
ADD_LIBRARY(redisai_tensorflow_obj OBJECT
Expand Down
4 changes: 4 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

#if defined(DEBUG) || defined(_DEBUG)
#include "readies/cetara/diag/gdb.h"
#endif
4 changes: 2 additions & 2 deletions test/includes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
COV = os.environ.get("COV") != "0" and os.environ.get("COV") != "0"
DEVICE = os.environ.get('DEVICE', 'CPU').upper().encode('utf-8', 'ignore').decode('utf-8')
VALGRIND = os.environ.get("VALGRIND") == "1"
print(f"Running tests on {DEVICE}\n")
print(f"Using a max of {MAX_ITERATIONS} iterations per test\n")
print("Running tests on {}\n".format(DEVICE))
print("Using a max of {} iterations per test\n".format(MAX_ITERATIONS))
# change this to make inference tests longer
MAX_TRANSACTIONS=100

Expand Down
8 changes: 4 additions & 4 deletions test/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ valgrind_config() {

run_tests() {
local title="$1"
[[ ! -z $title ]] && { $ROOT/opt/readies/bin/sep0; printf "Tests with $title:\n\n"; }
[[ ! -z $title ]] && { $ROOT/opt/readies/bin/sep -0; printf "Tests with $title:\n\n"; }
cd $ROOT/test
$OP python3 -m RLTest --clear-logs --module $MODULE $RLTEST_ARGS
}

Expand All @@ -102,16 +103,15 @@ OP=""
MODULE=${MODULE:-$1}
[[ -z $MODULE || ! -f $MODULE ]] && { echo "Module not found. Aborting."; exit 1; }

RLTEST_ARGS=""

[[ $VALGRIND == 1 || $VGD == 1 ]] && valgrind_config

if [[ ! -z $TEST ]]; then
RLTEST_ARGS+=" --test $TEST"
RLTEST_ARGS+=" --test $TEST -s"
export PYDEBUG=${PYDEBUG:-1}
fi

[[ $VERBOSE == 1 ]] && RLTEST_ARGS+=" -v"
[[ $GDB == 1 ]] && RLTEST_ARGS+=" -i --verbose"

#----------------------------------------------------------------------------------------------

Expand Down