Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
romilbhardwaj committed Jul 28, 2024
1 parent ba1c6c6 commit 3b3dd0d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sky/provision/kubernetes/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ def _formatted_resource_requirements(pod):
return ', '.join(f'{resource}={value}'
for resource, value in resource_requirements.items())

def _formatted_node_selector(pod):
def _formatted_node_selector(pod) -> Optional[str]:
# Returns a formatted string of node selectors for a pod.
node_selectors = []
if pod.spec.node_selector is None:
return
for label_key, label_value in pod.spec.node_selector.items():
node_selectors.append(f'{label_key}={label_value}')
return ', '.join(node_selectors)
Expand All @@ -123,7 +125,7 @@ def lack_resource_msg(resource, pod, extra_msg=None, details=None) -> str:
node_selectors) else ''
msg = (
f'Insufficient {resource} capacity on the cluster. '
f'Required resources({resource_requirements}){node_selector_str} '
f'Required resources ({resource_requirements}){node_selector_str} '
'were not found in a single node. Other SkyPilot tasks or pods may '
'be using resources. Check resource usage by running '
'`kubectl describe nodes`.')
Expand Down

0 comments on commit 3b3dd0d

Please sign in to comment.