Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
landscapepainter committed Sep 14, 2024
1 parent 38a64a1 commit ef0b295
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions sky/provision/kubernetes/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ def _create_pods(region: str, cluster_name_on_cloud: str,
'terminating pods. Waiting them to finish: '
f'{list(terminating_pods.keys())}')
time.sleep(POLL_INTERVAL)
terminating_pods = kubernetes_utils.filter_pods(namespace, context, tags,
['Terminating'])
terminating_pods = kubernetes_utils.filter_pods(namespace, context,
tags, ['Terminating'])

if len(terminating_pods) > 0:
# If there are still terminating pods, we force delete them.
Expand Down Expand Up @@ -548,7 +548,8 @@ def _create_pods(region: str, cluster_name_on_cloud: str,
if head_pod_name is None:
head_pod_name = pod.metadata.name

wait_pods_dict = kubernetes_utils.filter_pods(namespace, context, tags, ['Pending'])
wait_pods_dict = kubernetes_utils.filter_pods(namespace, context, tags,
['Pending'])
wait_pods = list(wait_pods_dict.values())

networking_mode = network_utils.get_networking_mode(
Expand Down Expand Up @@ -578,7 +579,8 @@ def _create_pods(region: str, cluster_name_on_cloud: str,
logger.debug(f'run_instances: all pods are scheduled and running: '
f'{list(wait_pods_dict.keys())}')

running_pods = kubernetes_utils.filter_pods(namespace, context, tags, ['Running'])
running_pods = kubernetes_utils.filter_pods(namespace, context, tags,
['Running'])
initialized_pods = kubernetes_utils.filter_pods(namespace, context, {
TAG_POD_INITIALIZED: 'true',
**tags
Expand Down Expand Up @@ -689,7 +691,6 @@ def terminate_instances(
}
pods = kubernetes_utils.filter_pods(namespace, context, tag_filters, None)


def _is_head(pod) -> bool:
return pod.metadata.labels[constants.TAG_RAY_NODE_KIND] == 'head'

Expand Down
3 changes: 2 additions & 1 deletion sky/provision/kubernetes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,8 @@ def get_namespace_from_config(provider_config: Dict[str, Any]) -> str:
get_current_kube_config_context_namespace())


def filter_pods(namespace: str, context: str,
def filter_pods(namespace: str,
context: str,
tag_filters: Dict[str, str],
status_filters: Optional[List[str]] = None) -> Dict[str, Any]:
"""Filters pods by tags and status."""
Expand Down

0 comments on commit ef0b295

Please sign in to comment.