Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Michaelvll committed Jan 5, 2025
1 parent a2fe5de commit 4fb0f90
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions sky/cloud_stores.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def _gsutil_command(self):
gsutil_alias, alias_gen = data_utils.get_gsutil_command()
return (f'{alias_gen}; GOOGLE_APPLICATION_CREDENTIALS='
f'{gcp.DEFAULT_GCP_APPLICATION_CREDENTIAL_PATH}; '
# Explicitly activate service account. Unlike the gcp packages
# and other GCP commands, gsutil does not automatically pick up
# the default credential keys when it is a service account.
'gcloud auth activate-service-account '
'--key-file=$GOOGLE_APPLICATION_CREDENTIALS '
'2> /dev/null || true; '
Expand Down
13 changes: 8 additions & 5 deletions sky/data/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,11 +523,14 @@ def get_gsutil_command() -> Tuple[str, str]:

def run_upload_cli(command: str, access_denied_message: str, bucket_name: str,
log_path: str):
returncode, stdout, stderr = log_lib.run_with_log(command,
log_path,
shell=True,
require_outputs=True,
executable='/bin/bash')
returncode, stdout, stderr = log_lib.run_with_log(
command,
log_path,
shell=True,
require_outputs=True,
# We need to use bash as some of the cloud commands uses bash syntax,
# such as [[ ... ]]
executable='/bin/bash')
if access_denied_message in stderr:
with ux_utils.print_exception_no_traceback():
raise PermissionError('Failed to upload files to '
Expand Down

0 comments on commit 4fb0f90

Please sign in to comment.