Skip to content

Commit

Permalink
Activate for controller as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michaelvll committed Jan 5, 2025
1 parent ff8c917 commit afce457
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 1 addition & 3 deletions sky/cloud_stores.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ 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}; '
'gcloud auth activate-service-account '
'--key-file=$GOOGLE_APPLICATION_CREDENTIALS '
'2> /dev/null || true; '
f'{gcp.ACTIVATE_SERVICE_ACCOUNT_COMMAND}; '
f'{gsutil_alias}')

def is_directory(self, url: str) -> bool:
Expand Down
7 changes: 7 additions & 0 deletions sky/clouds/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@
source ~/google-cloud-sdk/path.bash.inc >> {_GCLOUD_INSTALLATION_LOG} 2>&1; }}; }} && \
popd &>/dev/null'

ACTIVATE_SERVICE_ACCOUNT_COMMAND: str = (
'GOOGLE_APPLICATION_CREDENTIALS='
f'{DEFAULT_GCP_APPLICATION_CREDENTIAL_PATH} && '
'gcloud auth activate-service-account '
'--key-file=$GOOGLE_APPLICATION_CREDENTIALS '
'2> /dev/null || true')

# TODO(zhwu): Move the default AMI size to the catalog instead.
DEFAULT_GCP_IMAGE_GB = 50

Expand Down
3 changes: 2 additions & 1 deletion sky/utils/controller_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ def _get_cloud_dependencies_installation_commands(
elif isinstance(cloud, clouds.GCP):
step_prefix = prefix_str.replace('<step>', str(len(commands) + 1))
commands.append(f'echo -en "\\r{step_prefix}GCP SDK{empty_str}" &&'
f'{gcp.GOOGLE_SDK_INSTALLATION_COMMAND}')
f'{gcp.GOOGLE_SDK_INSTALLATION_COMMAND} && '
f'{{ {gcp.ACTIVATE_SERVICE_ACCOUNT_COMMAND}; }}')
elif isinstance(cloud, clouds.Kubernetes):
step_prefix = prefix_str.replace('<step>', str(len(commands) + 1))
commands.append(
Expand Down

0 comments on commit afce457

Please sign in to comment.