Skip to content

Commit

Permalink
update logic for running pods
Browse files Browse the repository at this point in the history
  • Loading branch information
alyssa1303 committed Nov 27, 2024
1 parent 5652571 commit 88c739e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/python/clusterloader2/kubernetes_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ def _is_node_untainted(self, node):
def get_pods_by_namespace(self, namespace, label_selector=None, field_selector=None):
return self.api.list_namespaced_pod(namespace=namespace, label_selector=label_selector, field_selector=field_selector).items

def get_running_pods_by_namespace(self, namespace=None, label_selector=None):
return self.get_pods_by_namespace(namespace=namespace, label_selector=label_selector, field_selector="status.phase=Running")
def get_running_pods_by_namespace(self, namespace=None, label_selector=None, field_selector=None):
pods = self.get_pods_by_namespace(namespace=namespace, label_selector=label_selector, field_selector=field_selector)
return [pod for pod in pods if pod.status.phase == "Running"]

def get_persistent_volume_claims_by_namespace(self, namespace):
return self.api.list_namespaced_persistent_volume_claim(namespace=namespace).items
Expand Down

0 comments on commit 88c739e

Please sign in to comment.