From 22e282ecb09d12a539c540b33c2b996b967f4a43 Mon Sep 17 00:00:00 2001 From: Jon Simantov Date: Thu, 13 Jul 2023 12:27:18 -0700 Subject: [PATCH 1/2] Add a retry decorator to the GitHub log downloader. --- external/pip_requirements.txt | 1 + scripts/gha/integration_testing/ftl_gha_validator.py | 4 +++- scripts/gha/python_requirements.txt | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/external/pip_requirements.txt b/external/pip_requirements.txt index 5aaa75d727..68af1aaee3 100644 --- a/external/pip_requirements.txt +++ b/external/pip_requirements.txt @@ -1,2 +1,3 @@ absl-py protobuf +retry diff --git a/scripts/gha/integration_testing/ftl_gha_validator.py b/scripts/gha/integration_testing/ftl_gha_validator.py index 5af4b5d3a3..8b165290d5 100644 --- a/scripts/gha/integration_testing/ftl_gha_validator.py +++ b/scripts/gha/integration_testing/ftl_gha_validator.py @@ -19,6 +19,7 @@ import subprocess import shutil import re +import retry GSUTIL = shutil.which("gsutil") @@ -73,7 +74,7 @@ def _get_testapp_log_text_from_gcs(gcs_path): logging.error("Unexpected error reading GCS log:\n%s", e) return None - +@retry(subprocess.CalledProcessError, retries=3, delay=10) def _gcs_list_dir(gcs_path): """Recursively returns a list of contents for a directory on GCS.""" args = [GSUTIL, "ls", "-r", gcs_path] @@ -82,6 +83,7 @@ def _gcs_list_dir(gcs_path): return result.stdout.splitlines() +@retry(subprocess.CalledProcessError, retries=3, delay=10) def _gcs_read_file(gcs_path): """Extracts the contents of a file on GCS.""" args = [GSUTIL, "cat", gcs_path] diff --git a/scripts/gha/python_requirements.txt b/scripts/gha/python_requirements.txt index 6541e322ff..ac784371ac 100644 --- a/scripts/gha/python_requirements.txt +++ b/scripts/gha/python_requirements.txt @@ -2,3 +2,4 @@ attrs absl-py pytz requests +retry From 7da1d4a44cc30bae87c006f537785d69a21c2f40 Mon Sep 17 00:00:00 2001 From: Jon Simantov Date: Thu, 13 Jul 2023 12:31:58 -0700 Subject: [PATCH 2/2] Fix retry syntax. --- scripts/gha/integration_testing/ftl_gha_validator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/gha/integration_testing/ftl_gha_validator.py b/scripts/gha/integration_testing/ftl_gha_validator.py index 8b165290d5..4350738245 100644 --- a/scripts/gha/integration_testing/ftl_gha_validator.py +++ b/scripts/gha/integration_testing/ftl_gha_validator.py @@ -19,7 +19,7 @@ import subprocess import shutil import re -import retry +from retry import retry GSUTIL = shutil.which("gsutil") @@ -74,7 +74,7 @@ def _get_testapp_log_text_from_gcs(gcs_path): logging.error("Unexpected error reading GCS log:\n%s", e) return None -@retry(subprocess.CalledProcessError, retries=3, delay=10) +@retry(subprocess.CalledProcessError, tries=3, delay=10) def _gcs_list_dir(gcs_path): """Recursively returns a list of contents for a directory on GCS.""" args = [GSUTIL, "ls", "-r", gcs_path] @@ -83,7 +83,7 @@ def _gcs_list_dir(gcs_path): return result.stdout.splitlines() -@retry(subprocess.CalledProcessError, retries=3, delay=10) +@retry(subprocess.CalledProcessError, tries=3, delay=10) def _gcs_read_file(gcs_path): """Extracts the contents of a file on GCS.""" args = [GSUTIL, "cat", gcs_path]