Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add messaging to kubernetes kill #2062

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion metaflow/plugins/kubernetes/kubernetes_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ def kill_pods(self, flow_name, run_id, user, echo):
job_api = self._client.BatchV1Api()
pods = self._find_active_pods(flow_name, run_id, user)

active_pods = False

def _kill_pod(pod):
active_pods = True
echo("Killing Kubernetes pod %s\n" % pod.metadata.name)
try:
stream(
Expand Down Expand Up @@ -155,7 +158,10 @@ def _kill_pod(pod):
echo("failed to kill pod %s - %s" % (pod.metadata.name, str(e)))

with ThreadPoolExecutor() as executor:
executor.map(_kill_pod, list(pods))
executor.map(_kill_pod, pods)

if not active_pods:
echo("No active Kubernetes pods found for run *%s*" % run_id)

def jobset(self, **kwargs):
return KubernetesJobSet(self, **kwargs)
Expand Down
Loading