Skip to content

Commit

Permalink
PR feedback part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
hemildesai committed Oct 4, 2023
1 parent caeb3ab commit 839ea03
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions sky/clouds/service_catalog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
def _map_clouds_catalog(clouds: CloudFilter, method_name: str, *args, **kwargs):
if clouds is None:
clouds = list(_ALL_CLOUDS)
if method_name == "list_accelerators":
clouds.append("kubernetes")

# TODO(hemil): Remove this once the common service catalog functions are refactored from clouds/kubernetes.py to kubernetes_catalog.py,
# and add kubernetes
if method_name == 'list_accelerators':
clouds.append('kubernetes')

single = isinstance(clouds, str)
if single:
Expand Down
7 changes: 6 additions & 1 deletion sky/clouds/service_catalog/kubernetes_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
from typing import Dict, List, Optional, Set, Tuple

import pandas as pd
from sky import global_user_state

from sky.clouds import Kubernetes
from sky.clouds.service_catalog import CloudFilter
from sky.clouds.service_catalog import common
from sky.utils import kubernetes_utils
Expand Down Expand Up @@ -38,6 +40,9 @@ def list_accelerators(
quantity_filter: Optional[int],
case_sensitive: bool = True
) -> Dict[str, List[common.InstanceTypeInfo]]:
if Kubernetes not in global_user_state.get_enabled_clouds() or not kubernetes_utils.check_credentials()[0]:
return {}

has_gpu = kubernetes_utils.detect_gpu_resource()
if not has_gpu:
return {}
Expand All @@ -63,7 +68,7 @@ def list_accelerators(
result = []
for accelerator_name, accelerator_count in accelerators:
result.append(
common.InstanceTypeInfo(cloud="Kubernetes",
common.InstanceTypeInfo(cloud='Kubernetes',
instance_type=None,
accelerator_name=accelerator_name,
accelerator_count=accelerator_count,
Expand Down

0 comments on commit 839ea03

Please sign in to comment.