mirror of
https://github.com/ROCm/jax.git
synced 2025-04-16 11:56:07 +00:00
Add a retry logic to avoid flakes when downloading Bazel
PiperOrigin-RevId: 720349541
This commit is contained in:
parent
4fe937683e
commit
36679d89e3
@ -76,3 +76,25 @@ if [[ $(uname -s) =~ "MSYS_NT" ]]; then
|
||||
# Convert all "JAXCI.*DIR" variables
|
||||
source <(python3 ./ci/utilities/convert_msys_paths_to_win_paths.py --convert $(env | grep "JAXCI.*DIR" | awk -F= '{print $1}'))
|
||||
fi
|
||||
|
||||
function retry {
|
||||
local cmd="$1"
|
||||
local max_attempts=3
|
||||
local attempt=1
|
||||
local delay=10
|
||||
|
||||
while [[ $attempt -le $max_attempts ]] ; do
|
||||
if eval "$cmd"; then
|
||||
return 0
|
||||
fi
|
||||
echo "Attempt $attempt failed. Retrying in $delay seconds..."
|
||||
sleep $delay # Prevent overloading
|
||||
|
||||
attempt=$((attempt + 1))
|
||||
done
|
||||
echo "$cmd failed after $max_attempts attempts."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Retry "bazel --version" 3 times to avoid flakiness when downloading bazel.
|
||||
retry "bazel --version"
|
||||
|
Loading…
x
Reference in New Issue
Block a user