Skip to content
This repository was archived by the owner on Feb 3, 2021. It is now read-only.

Commit 2db7b00

Browse files
committed
create virtual environment even if container exists
1 parent 4d4916e commit 2db7b00

1 file changed

Lines changed: 20 additions & 22 deletions

File tree

aztk/node_scripts/setup_host.sh

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,32 +71,32 @@ if [ $? -ne 0 ]; then
7171
exit 3
7272
fi
7373

74+
echo "Node python version:"
75+
python3 --version
76+
77+
# set up aztk python environment
78+
export LC_ALL=C.UTF-8
79+
export LANG=C.UTF-8
80+
python3 -m pip install pipenv
81+
mkdir -p $AZTK_WORKING_DIR/.aztk-env
82+
cp $AZTK_WORKING_DIR/aztk/node_scripts/Pipfile $AZTK_WORKING_DIR/.aztk-env
83+
cp $AZTK_WORKING_DIR/aztk/node_scripts/Pipfile.lock $AZTK_WORKING_DIR/.aztk-env
84+
cd $AZTK_WORKING_DIR/.aztk-env
85+
export PIPENV_VENV_IN_PROJECT=true
86+
pipenv install --python /usr/bin/python3.5m
87+
pipenv run pip install --upgrade setuptools wheel #TODO: add pip when pipenv is compatible with pip10
88+
89+
# Install python dependencies
90+
$AZTK_WORKING_DIR/.aztk-env/.venv/bin/pip install -r $(dirname $0)/requirements.txt
91+
export PYTHONPATH=$PYTHONPATH:$AZTK_WORKING_DIR
92+
7493
# If the container already exists just restart. Otherwise create it
7594
if [ "$(docker ps -a -q -f name=$container_name)" ]; then
7695
echo "Docker container is already setup. Restarting it."
7796
docker restart $container_name
7897
else
7998
echo "Creating docker container."
80-
81-
echo "Node python version:"
82-
python3 --version
83-
84-
# set up aztk python environment
85-
export LC_ALL=C.UTF-8
86-
export LANG=C.UTF-8
87-
python3 -m pip install pipenv
88-
mkdir -p $AZTK_WORKING_DIR/.aztk-env
89-
cp $AZTK_WORKING_DIR/aztk/node_scripts/Pipfile $AZTK_WORKING_DIR/.aztk-env
90-
cp $AZTK_WORKING_DIR/aztk/node_scripts/Pipfile.lock $AZTK_WORKING_DIR/.aztk-env
91-
cd $AZTK_WORKING_DIR/.aztk-env
92-
export PIPENV_VENV_IN_PROJECT=true
93-
pipenv install --python /usr/bin/python3.5m
94-
pipenv run pip install --upgrade setuptools wheel #TODO: add pip when pipenv is compatible with pip10
95-
96-
# Install python dependencies
97-
$AZTK_WORKING_DIR/.aztk-env/.venv/bin/pip install -r $(dirname $0)/requirements.txt
98-
export PYTHONPATH=$PYTHONPATH:$AZTK_WORKING_DIR
99-
99+
100100
echo "Running setup python script"
101101
$AZTK_WORKING_DIR/.aztk-env/.venv/bin/python $(dirname $0)/main.py setup-node $docker_repo_name
102102

@@ -105,8 +105,6 @@ else
105105
sleep 0.1;
106106
done;
107107

108-
109-
110108
# wait until container setup is complete
111109
echo "Waiting for spark docker container to setup."
112110
docker exec spark /bin/bash -c '$AZTK_WORKING_DIR/.aztk-env/.venv/bin/python $AZTK_WORKING_DIR/aztk/node_scripts/wait_until_setup_complete.py'

0 commit comments

Comments
 (0)