Skip to content

Commit 707e0e8

Browse files
kostmofacebook-github-bot
authored andcommitted
[WIP] retry apt at individual package level and at command level (pytorch#37696)
Summary: Pull Request resolved: pytorch#37696 Differential Revision: D21367632 Pulled By: kostmo fbshipit-source-id: 2f568ba2b404f2394875e0012fce5b930a16a9db
1 parent 5e0a24f commit 707e0e8

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

.circleci/scripts/setup_ci_environment.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ sudo rm -f /etc/apt/heroku.list
1313
sudo rm -f /etc/apt/openjdk-r-ubuntu-ppa-xenial.list
1414
sudo rm -f /etc/apt/partner.list
1515

16+
retry () {
17+
$* || $* || $* || $* || $*
18+
}
19+
20+
# Method adapted from here: https://askubuntu.com/questions/875213/apt-get-to-retry-downloading
21+
# (with use of tee to avoid permissions problems)
22+
# This is better than retrying the whole apt-get command
23+
echo "APT::Acquire::Retries \"3\";" | sudo tee /etc/apt/apt.conf.d/80-retries
24+
1625
sudo apt-get -y update
1726
sudo apt-get -y remove linux-image-generic linux-headers-generic linux-generic docker-ce
1827
# WARNING: Docker version is hardcoded here; you must update the
@@ -27,7 +36,11 @@ sudo apt-get -y remove linux-image-generic linux-headers-generic linux-generic d
2736
# Ubuntu version (e.g., docker run -it ubuntu:16.04) and then ask
2837
# apt what the packages you need are. Note that the CircleCI image
2938
# comes with Docker.
30-
sudo apt-get -y install \
39+
#
40+
# Using 'retry' here as belt-and-suspenders even though we are
41+
# presumably retrying at the single-package level via the
42+
# apt.conf.d/80-retries technique.
43+
retry sudo apt-get -y install \
3144
linux-headers-$(uname -r) \
3245
linux-image-generic \
3346
moreutils \
@@ -38,9 +51,6 @@ sudo apt-get -y install \
3851

3952
sudo pkill -SIGHUP dockerd
4053

41-
retry () {
42-
$* || $* || $* || $* || $*
43-
}
4454

4555
retry sudo pip -q install awscli==1.16.35
4656

0 commit comments

Comments
 (0)