Skip to content

Commit 76d7344

Browse files
committed
add retry mechanism and makefile phony
* context: pip install fails on large files due to network instability Signed-off-by: Jack Luar <[email protected]>
1 parent e5eaa1a commit 76d7344

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

tools/AutoTuner/Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.PHONY: init
2+
13
clearcache:
24
@echo "Cleaning python cache"
35
@find . -type d -name __pycache__ -exec rm -r {} \+

tools/AutoTuner/installer.sh

+21-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@ script_dir="$(dirname "${BASH_SOURCE[0]}")"
77
venv_name="autotuner_env"
88
python3 -m venv "$script_dir/$venv_name"
99
source "$script_dir/$venv_name/bin/activate"
10-
pip3 cache purge
11-
pip3 install --no-cache-dir -U -r $script_dir/requirements.txt
10+
retry_count=0
11+
max_retries=5
12+
success=false
13+
14+
while [[ $retry_count -lt $max_retries ]]; do
15+
if pip3 cache purge && pip3 install --no-cache-dir -U -r "$script_dir/requirements.txt"; then
16+
success=true
17+
break
18+
else
19+
retry_count=$((retry_count + 1))
20+
echo "Attempt $retry_count failed. Retrying in 1 minute..."
21+
sleep 60
22+
fi
23+
done
24+
25+
if [ "$success" = false ]; then
26+
echo "Failed to install requirements after $max_retries attempts."
27+
deactivate
28+
exit 1
29+
fi
30+
1231
deactivate

0 commit comments

Comments
 (0)