|
24 | 24 | from dags import composer_env |
25 | 25 | from dags.tpu_observability.utils import jobset_util as jobset |
26 | 26 | from dags.tpu_observability.utils import node_pool_util as node_pool |
27 | | -from dags.tpu_observability.utils.jobset_util import Workload, ReplicatedJobStatus |
| 27 | +from dags.tpu_observability.utils.jobset_util import Workload, JobSetHealthiness |
28 | 28 | from dags.tpu_observability.configs.common import ( |
29 | 29 | MachineConfigMap, |
30 | 30 | GCS_CONFIG_PATH, |
|
64 | 64 | doc_md=""" |
65 | 65 | # JobSet Healthiness Test For the "Suspended" Status |
66 | 66 | ### Description |
67 | | - This DAG automates the process of creating node-pools, ensuring the |
68 | | - correct number of "Suspended" replicas appear, then launching a jobset on |
69 | | - multiple replicas to ensure the correct number begin running. |
| 67 | + This DAG automates node-pool creation and validates JobSet healthiness |
| 68 | + by examining replica-based metrics: Specified, Active, Ready, |
| 69 | + Suspended, Succeeded, and Failed. It ensures the JobSet controller |
| 70 | + accurately reports these states during startup, maintenance, |
| 71 | + and failure scenarios. |
70 | 72 | ### Prerequisites |
71 | 73 | This test requires an existing cluster to run. |
72 | 74 | ### Procedures |
73 | | - First a node-pool is created. The validation test is then run to |
74 | | - check if the number of "Suspended" replicas is 0. Once the jobset is |
75 | | - running the jobs should quickly enter the "Ready" state. Then using |
76 | | - command to suspend entire jobset. The number of found replicas is |
77 | | - tested against the number of replicas which should be "Suspended". |
78 | | - If they match the DAG is a success. |
| 75 | + First a node-pool is created. This test uses a State-Trigger-Observe pattern: |
| 76 | + it triggers lifecycle transitions (e.g., suspension, failure or succeeded) |
| 77 | + and verifies that GKE telemetry reflects these shifts. Using sensors, |
| 78 | + the DAG polls for eventual consistency to account for ingestion latency, |
| 79 | + dynamically matching runtime JobSet configurations against normalized monitoring |
| 80 | + data types to ensure accurate state validation. |
79 | 81 | """, |
80 | 82 | ) as dag: |
81 | 83 | for machine in MachineConfigMap: |
|
119 | 121 |
|
120 | 122 | with TaskGroup(group_id="validate_running_metrics") as validate_running: |
121 | 123 | running_metrics = [ |
122 | | - (ReplicatedJobStatus.SPECIFIED, "USE_CONFIG_REPLICAS"), |
123 | | - (ReplicatedJobStatus.ACTIVE, "USE_CONFIG_REPLICAS"), |
124 | | - (ReplicatedJobStatus.READY, "USE_CONFIG_REPLICAS"), |
125 | | - (ReplicatedJobStatus.FAILED, 0), |
126 | | - (ReplicatedJobStatus.SUCCEEDED, 0), |
127 | | - (ReplicatedJobStatus.SUSPENDED, 0), |
| 124 | + (JobSetHealthiness.SPECIFIED, "USE_CONFIG_REPLICAS"), |
| 125 | + (JobSetHealthiness.ACTIVE, "USE_CONFIG_REPLICAS"), |
| 126 | + (JobSetHealthiness.READY, "USE_CONFIG_REPLICAS"), |
| 127 | + (JobSetHealthiness.FAILED, 0), |
| 128 | + (JobSetHealthiness.SUCCEEDED, 0), |
| 129 | + (JobSetHealthiness.SUSPENDED, 0), |
128 | 130 | ] |
129 | 131 | for status, expected in running_metrics: |
130 | 132 | jobset.wait_for_jobset_metrics.override( |
|
147 | 149 | group_id="validate_suspended_metrics" |
148 | 150 | ) as validate_suspended: |
149 | 151 | suspended_metrics = [ |
150 | | - (ReplicatedJobStatus.ACTIVE, 0), |
151 | | - (ReplicatedJobStatus.SUSPENDED, "USE_CONFIG_REPLICAS"), |
| 152 | + (JobSetHealthiness.ACTIVE, 0), |
| 153 | + (JobSetHealthiness.SUSPENDED, "USE_CONFIG_REPLICAS"), |
152 | 154 | ] |
153 | 155 | for status, expected in suspended_metrics: |
154 | 156 | jobset.wait_for_jobset_metrics.override( |
|
184 | 186 | validate_succeeded_metric = jobset.wait_for_jobset_metrics.override( |
185 | 187 | task_id="wait_for_succeeded_count" |
186 | 188 | )( |
187 | | - metric_name=ReplicatedJobStatus.SUCCEEDED, |
| 189 | + metric_name=JobSetHealthiness.SUCCEEDED, |
188 | 190 | expected_value="USE_CONFIG_REPLICAS", |
189 | 191 | node_pool=cluster_info, |
190 | 192 | jobset_config=jobset_config, |
|
209 | 211 | validate_failed_metric = jobset.wait_for_jobset_metrics.override( |
210 | 212 | task_id="wait_for_failed_count" |
211 | 213 | )( |
212 | | - metric_name=ReplicatedJobStatus.FAILED, |
| 214 | + metric_name=JobSetHealthiness.FAILED, |
213 | 215 | expected_value="USE_CONFIG_REPLICAS", |
214 | 216 | node_pool=cluster_info, |
215 | 217 | jobset_config=jobset_config, |
|
0 commit comments