Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions sky/backends/cloud_vm_ray_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,7 @@ def _insufficient_resources_msg(
elif to_provision.region is not None and to_provision.cloud is not None:
# For public clouds, provision.region is always set.
if clouds.SSH().is_same_cloud(to_provision.cloud):
assert to_provision.region.startswith("ssh-"), "SSH context must start with 'ssh-'"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, i thought a user does not need to specify ssh-. Is it true that the region has to be start with ssh-?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify these things, does region need to start with ssh, if yes do we need to strip away the ssh, if it does not start with ssh- we are not required to check right?

message += (
f'in SSH Node Pool ({to_provision.region.lstrip("ssh-")}) '
f'for {requested_resources}. The SSH Node Pool may not '
Expand Down
1 change: 1 addition & 0 deletions sky/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ def _dim_color(str_to_format: str) -> str:
'configuration.'))
else:
# Default case - not set up
assert context.startswith("ssh-"), "SSH context must start with 'ssh-'"
text_suffix = (': ' + _red_color('disabled. ') +
_dim_color('Reason: Not set up. Use '
'`sky ssh up --infra '
Expand Down
2 changes: 1 addition & 1 deletion sky/clouds/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def check_single_context(cls, context: str) -> Tuple[bool, str]:
@classmethod
def expand_infras(cls) -> List[str]:
return [
f'{cls.canonical_name()}/{c.lstrip("ssh-")}'
f'{cls.canonical_name()}/{c.lstrip("ssh-")}' if c.startswith("ssh-") else "."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just not use lstrip? also, why are we using . when it is not starting with ssh-?

for c in cls.existing_allowed_contexts(silent=True)
]

Expand Down
1 change: 1 addition & 0 deletions sky/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,7 @@ def _check_specified_regions(task: task_lib.Task) -> None:
msg = f'Task{task_name} requires '
if region not in existing_contexts:
if is_ssh:
assert region.startswith("ssh-"), "SSH context must start with 'ssh-'"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's get rid of using lstrip. Otherwise, ssh-ssabc will become abc

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of lstrip will it be ok if i use string slicing?

infra_str = f'SSH/{region.lstrip("ssh-")}'
else:
infra_str = f'Kubernetes/{region}'
Expand Down
Loading