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

Fix race condition when running ./bin/cli.sh #728

Merged
merged 2 commits into from
Mar 8, 2023
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
11 changes: 11 additions & 0 deletions bin/cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,26 @@ if [[ -z "$1" ]]; then
exit 1
elif [[ "$1" == "faasm" ]]; then
CLI_CONTAINER="faasm-cli"
VENV_ROOT=${PROJ_ROOT}/venv
elif [[ "$1" == "faasm-sgx-sim" ]]; then
CLI_CONTAINER="faasm-cli"
VENV_ROOT=${PROJ_ROOT}/venv
export FAASM_CLI_IMAGE=${FAASM_SGX_CLI_IMAGE:-faasm/cli-sgx-sim:$(cat ${PROJ_ROOT}/VERSION)}
export FAASM_WORKER_IMAGE=faasm/worker-sgx-sim:$(cat ${PROJ_ROOT}/VERSION)
export WASM_VM=sgx
elif [[ "$1" == "faasm-sgx" ]]; then
CLI_CONTAINER="faasm-cli"
VENV_ROOT=${PROJ_ROOT}/venv
export FAASM_CLI_IMAGE=${FAASM_SGX_CLI_IMAGE:-faasm/cli-sgx:$(cat ${PROJ_ROOT}/VERSION)}
export FAASM_WORKER_IMAGE=faasm/worker-sgx:$(cat ${PROJ_ROOT}/VERSION)
export WASM_VM=sgx
start_sgx_aesmd_socket
elif [[ "$1" == "cpp" ]]; then
CLI_CONTAINER="cpp"
VENV_ROOT=${PROJ_ROOT}/clients/cpp/venv
elif [[ "$1" == "python" ]]; then
CLI_CONTAINER="python"
VENV_ROOT=${PROJ_ROOT}/clients/python/venv
else
usage
exit 1
Expand All @@ -82,6 +87,12 @@ docker compose \
-d \
${CLI_CONTAINER}

until test -f ${VENV_ROOT}/faasm_venv.BUILT
do
echo "Waiting for python virtual environment to be ready..."
sleep 3
done

# Attach to the CLI container
docker compose \
exec \
Expand Down
2 changes: 2 additions & 0 deletions bin/create_venv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ pushd faasmcli >> /dev/null
pip_cmd install -e .
popd >> /dev/null

touch ${VENV_PATH}/faasm_venv.BUILT

popd >> /dev/null
2 changes: 1 addition & 1 deletion clients/cpp
Submodule cpp updated 1 files
+2 −0 bin/create_venv.sh
2 changes: 1 addition & 1 deletion clients/python
Submodule python updated 1 files
+2 −0 bin/create_venv.sh