From 0eb1ecdc26cf7dde4109cbb9e3ad0f12385a0c72 Mon Sep 17 00:00:00 2001 From: Romil Bhardwaj Date: Thu, 5 Sep 2024 17:54:58 -0700 Subject: [PATCH 1/2] fix --- sky/provision/kubernetes/instance.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sky/provision/kubernetes/instance.py b/sky/provision/kubernetes/instance.py index a233b7a944f..478d59eeb83 100644 --- a/sky/provision/kubernetes/instance.py +++ b/sky/provision/kubernetes/instance.py @@ -530,7 +530,9 @@ def _create_pods(region: str, cluster_name_on_cloud: str, 'override runtimeClassName in ~/.sky/config.yaml. ' 'For more details, refer to https://skypilot.readthedocs.io/en/latest/reference/config.html') # pylint: disable=line-too-long - if nvidia_runtime_exists: + needs_gpus = (pod_spec['spec']['containers'][0].get('resources', {}). + get('limits', {}).get('nvidia.com/gpu', 0) > 0) + if nvidia_runtime_exists and needs_gpus: pod_spec['spec']['runtimeClassName'] = 'nvidia' created_pods = {} From 22ccbbf41082dd3629778d0be9895047ffa039ac Mon Sep 17 00:00:00 2001 From: Romil Bhardwaj Date: Fri, 6 Sep 2024 10:07:06 -0700 Subject: [PATCH 2/2] lint --- sky/provision/kubernetes/instance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sky/provision/kubernetes/instance.py b/sky/provision/kubernetes/instance.py index 478d59eeb83..9402b349e4f 100644 --- a/sky/provision/kubernetes/instance.py +++ b/sky/provision/kubernetes/instance.py @@ -530,8 +530,8 @@ def _create_pods(region: str, cluster_name_on_cloud: str, 'override runtimeClassName in ~/.sky/config.yaml. ' 'For more details, refer to https://skypilot.readthedocs.io/en/latest/reference/config.html') # pylint: disable=line-too-long - needs_gpus = (pod_spec['spec']['containers'][0].get('resources', {}). - get('limits', {}).get('nvidia.com/gpu', 0) > 0) + needs_gpus = (pod_spec['spec']['containers'][0].get('resources', {}).get( + 'limits', {}).get('nvidia.com/gpu', 0) > 0) if nvidia_runtime_exists and needs_gpus: pod_spec['spec']['runtimeClassName'] = 'nvidia'