Skip to content

Add log to gsutil fetch. #1411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions scripts/gha/integration_testing/ftl_gha_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,18 @@ def _gcs_list_dir(gcs_path):
"""Recursively returns a list of contents for a directory on GCS."""
args = [GSUTIL, "ls", "-r", gcs_path]
logging.info("Listing GCS contents: %s", " ".join(args))
result = subprocess.run(args=args, capture_output=True, text=True, check=True)
try:
result = subprocess.run(args=args, capture_output=True, text=True, check=True)
except subprocess.CalledProcessError as e:
# It's possible to have a CalledProcessError but still have gotten a file list.
# Check the stdout to see if we got lines that look GCS file paths, and ignore
# the error if so.
output = e.output.splitlines()
if len(output) > 1 and gcs_path in output[0]:
return output
else:
print("Error: %s" % e.stderr)
raise e
return result.stdout.splitlines()


Expand All @@ -88,7 +99,11 @@ def _gcs_read_file(gcs_path):
"""Extracts the contents of a file on GCS."""
args = [GSUTIL, "cat", gcs_path]
logging.info("Reading GCS file: %s", " ".join(args))
result = subprocess.run(args=args, capture_output=True, text=True, check=True)
try:
result = subprocess.run(args=args, capture_output=True, text=True, check=True)
except subprocess.CalledProcessError as e:
print("Error: %s" % e.stderr)
raise e
return result.stdout


Expand Down