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

Test charts #262

Draft
wants to merge 24 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
4 changes: 3 additions & 1 deletion dff/stats/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def get_superset_session(args: Namespace, base_url: str = "http://localhost:8088

:return: Authorized session - authorization headers tuple.
"""
username = args.username
password = args.password
healthcheck_url = parse.urljoin(base_url, "/healthcheck")
login_url = parse.urljoin(base_url, "/api/v1/security/login")
csrf_url = parse.urljoin(base_url, "/api/v1/security/csrf_token/")
Expand All @@ -121,7 +123,7 @@ def get_superset_session(args: Namespace, base_url: str = "http://localhost:8088
access_request = session.post(
login_url,
headers={"Content-Type": "application/json", "Accept": "*/*"},
data=json.dumps({"username": args.username, "password": args.password, "refresh": True, "provider": "db"}),
data=json.dumps({"username": username, "password": password, "refresh": True, "provider": "db"}),
)
access_token = access_request.json()["access_token"]
# get csrf_token
Expand Down
1 change: 1 addition & 0 deletions dff/utils/docker/dockerfile_stats
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM apache/superset:2.1.0rc1
USER root
RUN cd /app && pip install .[clickhouse]
COPY health_stats.sh /app/docker/
COPY entrypoint_stats.sh /app/docker/
COPY --chown=superset superset_config_docker.py /app/pythonpath/
ENV SUPERSET_CONFIG_PATH /app/pythonpath/superset_config_docker.py
Expand Down
2 changes: 1 addition & 1 deletion dff/utils/docker/entrypoint_stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
export SERVER_THREADS_AMOUNT=8
set -m
nohup /bin/bash /usr/bin/run-server.sh &
sleep 5
/bin/bash /app/docker/health_stats.sh
superset fab create-admin --firstname superset --lastname admin --username $SUPERSET_USERNAME --email [email protected] --password $SUPERSET_PASSWORD
superset db upgrade
superset init
Expand Down
18 changes: 18 additions & 0 deletions dff/utils/docker/health_stats.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
for itr in {1..10}
do
healthcheck=$(curl -X GET http://localhost:8088/health | grep "OK")
healthcheck=$?
if [ "$healthcheck" -ne 0 ] ; then
echo "Healthcheck failed. sleeping for 5 secs"
sleep 5
echo 'Iteration' $itr
if [ $itr == 10 ]; then
echo 'Healthcheck suite unsuccessful.'
fi
else
echo "Healthcheck suite succesful."
break
exit 0
fi
done
Loading