Spaces:
Sleeping
Sleeping
Commit
·
c718ed6
1
Parent(s):
10bd478
Prepare new Python env using pyenv if demo
Browse files
hf.sh
CHANGED
@@ -24,6 +24,13 @@ if [ ! -z "${SPACE_ID}" ] && [ "${DEMO_SPACE_ID}" == "${SPACE_ID}" ]
|
|
24 |
then
|
25 |
# Generate GISKARD_DEFAULT_API_KEY in demo space instead of set from Secrets
|
26 |
export GISKARD_DEFAULT_API_KEY=gsk-$(cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-28} | head -n 1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
# Append demo worker supervisord item to conf
|
28 |
echo """
|
29 |
[program:demo_worker]
|
@@ -33,7 +40,7 @@ autorestart=true
|
|
33 |
redirect_stderr=true
|
34 |
startsecs=0
|
35 |
startretries=5000
|
36 |
-
command=/bin/bash -c '
|
37 |
""" >> "${GSK_DIST_PATH}/supervisord.conf"
|
38 |
fi
|
39 |
|
|
|
24 |
then
|
25 |
# Generate GISKARD_DEFAULT_API_KEY in demo space instead of set from Secrets
|
26 |
export GISKARD_DEFAULT_API_KEY=gsk-$(cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-28} | head -n 1)
|
27 |
+
# Prepare a new env for demo worker
|
28 |
+
curl https://pyenv.run | bash
|
29 |
+
pyenv install $(python --version | cut -d' ' -f2)
|
30 |
+
pyenv global $(python --version | cut -d' ' -f2)
|
31 |
+
pip install --upgrade pip
|
32 |
+
WHEEL=$(ls $GSK_DIST_PATH/python-client/giskard*.whl) && pip install $WHEEL\[server\]
|
33 |
+
pip install -r /requirements.txt
|
34 |
# Append demo worker supervisord item to conf
|
35 |
echo """
|
36 |
[program:demo_worker]
|
|
|
40 |
redirect_stderr=true
|
41 |
startsecs=0
|
42 |
startretries=5000
|
43 |
+
command=/bin/bash -c 'python -m giskard.cli worker start -u \"http://localhost:9000\" -k \"\$GISKARD_DEFAULT_API_KEY\"; sleep 5'
|
44 |
""" >> "${GSK_DIST_PATH}/supervisord.conf"
|
45 |
fi
|
46 |
|