Skip to content

Commit a46e613

Browse files
committed
add retry to at installer
Signed-off-by: luarss <[email protected]>
1 parent b91acd0 commit a46e613

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tools/AutoTuner/installer.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,27 @@ 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 install -e "$script_dir"
10+
11+
retry_count=0
12+
max_retries=5
13+
success=false
14+
15+
while [[ $retry_count -lt $max_retries ]]; do
16+
if pip3 cache purge && pip3 install --no-cache-dir -U -r "$script_dir/requirements.txt"; then
17+
success=true
18+
break
19+
else
20+
retry_count=$((retry_count + 1))
21+
echo "Attempt $retry_count failed. Retrying in 1 minute..."
22+
sleep 60
23+
fi
24+
done
25+
26+
if [ "$success" = false ]; then
27+
echo "Failed to install requirements after $max_retries attempts."
28+
deactivate
29+
exit 1
30+
fi
31+
32+
pip3 install --no-cache-dir -e "$script_dir"
1133
deactivate

0 commit comments

Comments
 (0)