Skip to content

Commit

Permalink
PR feedback part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
hemildesai committed Oct 5, 2023
1 parent 58b9f3e commit fa0df6a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions sky/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3261,6 +3261,11 @@ def _output():
clouds=cloud,
region_filter=region,
)

if len(result) == 0 and cloud == 'kubernetes':
yield kubernetes_utils.NO_GPU_ERROR_MESSAGE
return

# "Common" GPUs
for gpu in service_catalog.get_common_gpus():
if gpu in result:
Expand Down Expand Up @@ -3317,6 +3322,10 @@ def _output():
case_sensitive=False)

if len(result) == 0:
if cloud == 'kubernetes':
yield kubernetes_utils.NO_GPU_ERROR_MESSAGE
return

quantity_str = (f' with requested quantity {quantity}'
if quantity else '')
yield f'Resources \'{name}\'{quantity_str} not found. '
Expand Down
9 changes: 8 additions & 1 deletion sky/utils/kubernetes_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'T': 2**40,
'P': 2**50,
}
NO_GPU_ERROR_MESSAGE = 'No GPUs found in Kubernetes cluster. If your cluster contains GPUs, make sure nvidia.com/gpu resource is available on the nodes and the node labels for identifying GPUs (e.g., skypilot.co/accelerators) are setup correctly. To further debug, run: sky check.'

logger = sky_logging.init_logger(__name__)

Expand Down Expand Up @@ -163,7 +164,13 @@ def get_label_value(cls, accelerator: str) -> str:

@classmethod
def get_accelerator_from_label_value(cls, value: str) -> str:
return value.split('-')[-1].upper()
if value.startswith('nvidia-tesla-'):
return value.replace('nvidia-tesla-', '').upper()
elif value.startswith('nvidia-'):
return value.replace('nvidia-', '').upper()
else:
raise ValueError(
f'Invalid accelerator name in GKE cluster: {value}')


# LABEL_FORMATTER_REGISTRY stores the label formats SkyPilot will try to
Expand Down

0 comments on commit fa0df6a

Please sign in to comment.