You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ks...@apache.org on 2022/04/26 10:20:58 UTC

[arrow] branch master updated: ARROW-14651: [Release][Archery] Add support for retrying download

This is an automated email from the ASF dual-hosted git repository.

kszucs pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 05e09f6414 ARROW-14651: [Release][Archery] Add support for retrying download
05e09f6414 is described below

commit 05e09f6414359834325a89cebbf3bf2f525e4e2a
Author: Sutou Kouhei <ko...@clear-code.com>
AuthorDate: Tue Apr 26 12:20:49 2022 +0200

    ARROW-14651: [Release][Archery] Add support for retrying download
    
    Closes #12996 from kou/archery-release-retry
    
    Lead-authored-by: Sutou Kouhei <ko...@clear-code.com>
    Co-authored-by: Sutou Kouhei <ko...@cozmixng.org>
    Co-authored-by: Krisztián Szűcs <sz...@gmail.com>
    Signed-off-by: Krisztián Szűcs <sz...@gmail.com>
---
 dev/archery/archery/crossbow/cli.py | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/dev/archery/archery/crossbow/cli.py b/dev/archery/archery/crossbow/cli.py
index 42d6f5c730..cc4c648c6d 100644
--- a/dev/archery/archery/crossbow/cli.py
+++ b/dev/archery/archery/crossbow/cli.py
@@ -16,6 +16,7 @@
 # under the License.
 
 from pathlib import Path
+import time
 
 import click
 
@@ -339,7 +340,23 @@ def download_artifacts(obj, job_name, target_dir, dry_run, fetch,
             path = target_dir / task_name / asset.name
             path.parent.mkdir(exist_ok=True)
             if not dry_run:
-                asset.download(path)
+                import github3
+                max_n_retries = 5
+                n_retries = 0
+                while True:
+                    try:
+                        asset.download(path)
+                    except github3.exceptions.GitHubException as error:
+                        n_retries += 1
+                        if n_retries == max_n_retries:
+                            raise
+                        wait_seconds = 60
+                        click.echo(f'Failed to download {path}')
+                        click.echo(f'Retry #{n_retries} after {wait_seconds}s')
+                        click.echo(error)
+                        time.sleep(wait_seconds)
+                    else:
+                        break
 
     click.echo('Downloading {}\'s artifacts.'.format(job_name))
     click.echo('Destination directory is {}'.format(target_dir))