Skip to content

Commit a437787

Browse files
authored
fix: Correct doc-string for get_active_pods task (GoogleCloudPlatform#1111)
This change renames the task of `get_active_pods` to `list_pod_names` to more accurately reflect its behavior (returning a list of strings rather than pod objects). It also cleans up the doc-string which contained redundant and conflicting information about JobSet deletion.
1 parent 175996c commit a437787

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

dags/tpu_observability/tpu_info_format_validation_dags.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,19 +403,19 @@ def generate_second_node_pool_name(
403403
namespace=jobset_config.namespace,
404404
)
405405

406-
active_pods = jobset.get_active_pods.override(task_id="get_active_pod")(
406+
pod_names = jobset.list_pod_names.override(task_id="list_pod_names")(
407407
node_pool=cluster_info,
408408
namespace=jobset_config.namespace,
409409
)
410410

411411
wait_for_job_start = jobset.wait_for_jobset_started.override(
412412
task_id="wait_for_job_start"
413-
)(cluster_info, pod_name_list=active_pods, job_apply_time=apply_time)
413+
)(cluster_info, pod_name_list=pod_names, job_apply_time=apply_time)
414414

415415
outputs_of_tpu_info = (
416416
get_tpu_info_from_pod.override(task_id="get_tpu_info")
417417
.partial(info=cluster_info)
418-
.expand(pod_name=active_pods)
418+
.expand(pod_name=pod_names)
419419
)
420420

421421
output_of_tpu_info = (
@@ -514,7 +514,7 @@ def generate_second_node_pool_name(
514514
>> cluster_info_2
515515
>> create_node_pool
516516
>> apply_time
517-
>> active_pods
517+
>> pod_names
518518
>> wait_for_job_start
519519
>> outputs_of_tpu_info
520520
>> output_of_tpu_info

dags/tpu_observability/utils/jobset_util.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,20 +420,24 @@ def end_workload(node_pool: node_pool_info, jobset_name: str, namespace: str):
420420

421421

422422
@task
423-
def get_active_pods(node_pool: node_pool_info, namespace: str) -> list[str]:
423+
def list_pod_names(node_pool: node_pool_info, namespace: str) -> list[str]:
424424
"""
425-
Deletes all JobSets from the GKE cluster to clean up resources.
425+
Retrieves a list of active pod names from a specific GKE cluster namespace.
426426
427-
This task executes a bash script to:
428-
1. Authenticate `gcloud` with the specified GKE cluster.
429-
2. Delete all JobSets in the `default` namespace using `kubectl`.
427+
This task executes a series of shell commands to:
428+
1. Authenticate `gcloud` and generate a temporary kubeconfig for the cluster.
429+
2. Query `kubectl` to fetch pod names filtered by the provided namespace.
430430
431431
Args:
432432
node_pool: Configuration object with cluster details.
433-
namespace: The YamlConfig object containing namespace information.
433+
namespace: The Kubernetes namespace to query for pods.
434434
435435
Returns:
436-
A list of pod names.
436+
A list of strings representing the names of the active pods.
437+
438+
Raises:
439+
AirflowFailException: If the command returns an empty output or fails to
440+
retrieve any pod names.
437441
"""
438442
with tempfile.NamedTemporaryFile() as temp_config_file:
439443
env = os.environ.copy()

0 commit comments

Comments
 (0)