mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Modify our curl commands so that they always retry downloads. By default, curl only retries what it considers to be "transient" errors, based on the server's response. However, curl's estimate of what's transient is very conservative. By adding the --retry-all-errors parameter we'll always retry curl commands. In particular, I'm hoping this mitigates errors where curl fails with the below error ([logs](https://github.com/pytorch/pytorch/actions/runs/3468758110/jobs/5794939941)) `curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to ossci-linux.s3.amazonaws.com:443` Some of the modified downloads didn't even have retries, so I added them in More details: https://everything.curl.dev/usingcurl/downloads/retry Pull Request resolved: https://github.com/pytorch/pytorch/pull/89157 Approved by: https://github.com/kit1980, https://github.com/malfet
51 lines
1.6 KiB
Bash
Executable File
51 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eux -o pipefail
|
|
|
|
# Set up CircleCI GPG keys for apt, if needed
|
|
curl --retry 3 --retry-all-errors -s -L https://packagecloud.io/circleci/trusty/gpgkey | sudo apt-key add -
|
|
|
|
# Stop background apt updates. Hypothetically, the kill should not
|
|
# be necessary, because stop is supposed to send a kill signal to
|
|
# the process, but we've added it for good luck. Also
|
|
# hypothetically, it's supposed to be unnecessary to wait for
|
|
# the process to block. We also have that line for good luck.
|
|
# If you like, try deleting them and seeing if it works.
|
|
sudo systemctl stop apt-daily.service || true
|
|
sudo systemctl kill --kill-who=all apt-daily.service || true
|
|
|
|
sudo systemctl stop unattended-upgrades.service || true
|
|
sudo systemctl kill --kill-who=all unattended-upgrades.service || true
|
|
|
|
# wait until `apt-get update` has been killed
|
|
while systemctl is-active --quiet apt-daily.service
|
|
do
|
|
sleep 1;
|
|
done
|
|
while systemctl is-active --quiet unattended-upgrades.service
|
|
do
|
|
sleep 1;
|
|
done
|
|
|
|
# See if we actually were successful
|
|
systemctl list-units --all | cat
|
|
|
|
# For good luck, try even harder to kill apt-get
|
|
sudo pkill apt-get || true
|
|
|
|
# For even better luck, purge unattended-upgrades
|
|
sudo apt-get purge -y unattended-upgrades || true
|
|
|
|
cat /etc/apt/sources.list
|
|
|
|
# For the bestest luck, kill again now
|
|
sudo pkill apt || true
|
|
sudo pkill dpkg || true
|
|
|
|
# Try to detect if apt/dpkg is stuck
|
|
if ps auxfww | grep '[a]pt'; then
|
|
echo "WARNING: There are leftover apt processes; subsequent apt update will likely fail"
|
|
fi
|
|
if ps auxfww | grep '[d]pkg'; then
|
|
echo "WARNING: There are leftover dpkg processes; subsequent apt update will likely fail"
|
|
fi
|