Skip to content
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

Add test mode #226

Merged
merged 5 commits into from
Feb 15, 2024
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
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ QUERY?=select version();
SHELL:=/bin/bash
SPARK_ENV_FILE:=docker-spark/docker/.env
GF_ENV_FILE:=docker-grafana/.env
export VERSION=v0.2.0

help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-22s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' "$(firstword $(MAKEFILE_LIST))"
Expand Down Expand Up @@ -123,11 +124,6 @@ verticapylab-start: etc/VerticaPyLab.conf ## Start a jupyterlab
# testing it locally before pushing it to dockerhub
.PHONY: verticapylab-build
verticapylab-build: etc/VerticaPyLab.conf
@source etc/VerticaPyLab.conf; \
if [[ $$VERTICAPYLAB_IMG_VERSION == latest ]] ; then \
echo "Set a version number for VERTICAPYLAB_IMG_VERSION in etc/VerticaPyLab.conf"; \
exit 1; \
fi; \
bin/verticapylab-build

# this builds images for multiple platforms and pushes them to docker hub
Expand Down Expand Up @@ -163,6 +159,9 @@ verticapylab-stop: ## Shut down the jupyterlab server and remove the container
.PHONY: verticapylab-uninstall
verticapylab-uninstall: ## Remove the verticapylab container and associated images.
@source etc/VerticaPyLab.conf; \
if [[ $${TEST_MODE^^} == "YES" ]] ; then \
VERTICAPYLAB_IMG_VERSION=$(VERSION); \
fi; \
docker stop "$$VERTICAPYLAB_CONTAINER_NAME" >/dev/null 2>&1; \
docker image rm "vertica/$$VERTICAPYLAB_IMG:$$VERTICAPYLAB_IMG_VERSION"

Expand Down
26 changes: 26 additions & 0 deletions bin/verticapylab
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ while getopts "p:c:i:h" opt; do
esac
done

if [[ ${TEST_MODE^^} == "YES" ]]
then
VERTICAPYLAB_IMG_VERSION=$VERSION
fi

VERTICAPYLAB_RUNARGS+=( -v $WORKSPACE:/project )
VERTICAPYLAB_RUNARGS+=( -v $WORKSPACE_ENABLEMENT:/project/demos/enablement:ro )

Expand Down Expand Up @@ -118,6 +123,27 @@ Host $VERTICA_HOST_NAME $SSH_CONFIG_EXTRA_HOSTNAME
User dbadmin
" | docker exec -i "$VERTICAPYLAB_CONTAINER_NAME" bash -c 'umask 077; mkdir -p $HOME/.ssh; cat >> $HOME/.ssh/config'

if [[ ${TEST_MODE^^} == "YES" ]]
then
trap ' tput setaf 1; echo "VerticaPy installation failed"; tput sgr0; ' EXIT

echo "Uninstalling old VerticaPy"
docker exec -i "$VERTICAPYLAB_CONTAINER_NAME" pip uninstall --yes verticapy 2> /dev/null
echo "Installing latest VerticaPy"
if docker exec -i "$VERTICAPYLAB_CONTAINER_NAME" pip install -q git+https://github.com/vertica/VerticaPy 2> /dev/null; then
echo "Installation done!"
else
docker stop "$VERTICAPYLAB_CONTAINER_NAME"
exit 1
fi

trap EXIT

tput setaf 2
echo "VerticaPy installed successfully"
tput sgr0
fi

echo "Starting..."
# sleep some time to wait for jupyterlab logs
timeout=10 #seconds
Expand Down
10 changes: 10 additions & 0 deletions bin/verticapylab-build
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ fi
# Load the configuration
source $CONFIG_FILE || abort $? "Cannot load config file $CONFIG_FILE"

if [[ ${TEST_MODE^^} == "YES" ]]
then
VERTICAPYLAB_IMG_VERSION=$VERSION
fi

if [[ $VERTICAPYLAB_IMG_VERSION == latest ]] ; then
echo "Set a version number for VERTICAPYLAB_IMG_VERSION in etc/VerticaPyLab.conf";
exit 1
fi

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
REPO_DIR=$(dirname $SCRIPT_DIR)

Expand Down
30 changes: 8 additions & 22 deletions docker-verticapy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,21 @@ ARG SPARK_VERSION="3.3.2"
FROM python:${PYTHON_VERSION}

ENV PIP_NO_CACHE_DIR=1
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ARG GF_PORT
ARG SPARK_VERSION

WORKDIR /project

COPY requirements.txt requirements.txt
COPY ./bin /usr/bin/
COPY ./extensions/ /project/

RUN apt-get update \
&& apt-get install -y \
&& apt-get install -y --fix-missing\
software-properties-common \
gpg \
libgdal-dev \
g++ \
git \
ssh \
graphviz \
openjdk-11-jdk \
Expand All @@ -33,9 +30,7 @@ RUN apt-get update \
curl \
dirmngr \
apt-transport-https \
lsb-release ca-certificates \
# Set the port number for grafana extensions
&& sed -i s/PORT/${GF_PORT}/ /project/verticatools/src/index.ts
lsb-release ca-certificates

RUN apt-get upgrade -y
RUN apt-get clean
Expand All @@ -46,25 +41,16 @@ ENV SPARK_VERSION=${SPARK_VERSION}
# Install python dependencies
RUN pip install --upgrade pip \
&& pip install -r requirements.txt \
&& rm requirements.txt \
&& curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get -y install nodejs

RUN pip install /project/theme \
&& pip install /project/verticatools \
&& pip install PySpark==${SPARK_VERSION} \
&& pip install PrettyTable \
&& rm -r /project/verticatools \
&& rm -r /project/theme \
&& rm -r /project/sql-editor \
&& chmod 755 /usr/bin/admintools \
&& chmod 755 /usr/bin/vsql \
&& chmod 755 /usr/bin/run-vsql \
&& chmod 755 /usr/bin/run-admintools
# Uncomment the jupyter labextension line below to install jupyterlab-chart-editor
# We are still having some problem to install it in some environments and we are still
# investigating.
# && jupyter labextension install jupyterlab-chart-editor
&& chmod 755 /usr/bin/run-admintools \
&& rm requirements.txt \
# Install nodejs
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get -y install nodejs


EXPOSE 8888
Expand Down
12 changes: 7 additions & 5 deletions docker-verticapy/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
jupyterlab==3.4.8
jupyterlab-lsp==3.10.2
jupyterlab==4.0.7
jupyterlab-lsp==5.0.0
python-lsp-server[all]
ipython==8.5.0
ipywidgets==7.6.5
voila==0.3.6
ipython==8.18.0
ipywidgets==8.1.0
voila==0.5.4
graphviz==0.20.1
plotly==5.14.1
verticapy
jupyter_app_launcher
pickleshare
1 change: 1 addition & 0 deletions project/data/icons/query.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions project/data/icons/verticapy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions project/jp_app_launcher.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- title: Connect
description: Create a connection
source: /voila/render/ui/conn.ipynb
type: url
catalog: VerticaPy UI
icon: /project/data/icons/verticapy.svg
args:
createNewWindow: true


- title: Query Profiler
description: Query Profiler User Interface
source: /voila/render/ui/qprof_main.ipynb
type: url
catalog: VerticaPy UI
icon: /project/data/icons/query.svg
args:
createNewWindow: true
Loading
Loading