diff --git a/tools/AutoTuner/Makefile b/tools/AutoTuner/Makefile index 43d9c7ed48..05fa8eb721 100644 --- a/tools/AutoTuner/Makefile +++ b/tools/AutoTuner/Makefile @@ -1,3 +1,5 @@ +.PHONY: init + clearcache: @echo "Cleaning python cache" @find . -type d -name __pycache__ -exec rm -r {} \+ diff --git a/tools/AutoTuner/installer.sh b/tools/AutoTuner/installer.sh index 31f7cc8733..f93c765113 100755 --- a/tools/AutoTuner/installer.sh +++ b/tools/AutoTuner/installer.sh @@ -7,6 +7,25 @@ script_dir="$(dirname "${BASH_SOURCE[0]}")" venv_name="autotuner_env" python3 -m venv "$script_dir/$venv_name" source "$script_dir/$venv_name/bin/activate" -pip3 cache purge -pip3 install --no-cache-dir -U -r $script_dir/requirements.txt +retry_count=0 +max_retries=5 +success=false + +while [[ $retry_count -lt $max_retries ]]; do + if pip3 cache purge && pip3 install --no-cache-dir -U -r "$script_dir/requirements.txt"; then + success=true + break + else + retry_count=$((retry_count + 1)) + echo "Attempt $retry_count failed. Retrying in 1 minute..." + sleep 60 + fi +done + +if [ "$success" = false ]; then + echo "Failed to install requirements after $max_retries attempts." + deactivate + exit 1 +fi + deactivate