Skip to content

Commit 8a98414

Browse files
authored
Add log metadata additional logs to TPU-observability DAGs (GoogleCloudPlatform#1055)
This change adds runtime-environment logging to selected TPU-observability DAGs to surface execution context. It improves troubleshooting efficiency and aligns with the conventions used in the DAG PLX dashboard.
1 parent 107021c commit 8a98414

5 files changed

Lines changed: 203 additions & 57 deletions

File tree

dags/tpu_observability/multi_host_nodepool_rollback_dag.py

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
"""A DAG to ensure a rollback effects the availablility of a mult-host GKE node pool as expected."""
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""
16+
A DAG to ensure a rollback effects the availability of a multi-host GKE node
17+
pool as expected.
18+
"""
219

320
import datetime
421

@@ -8,12 +25,14 @@
825
from airflow.utils.trigger_rule import TriggerRule
926

1027
from dags.map_reproducibility.utils import constants
11-
from dags.common.vm_resource import Project, Region, Zone
28+
from dags.common.vm_resource import Region, Zone
1229
from dags.tpu_observability.utils import node_pool_util as node_pool
1330
from dags.tpu_observability.configs.common import MachineConfigMap
1431

1532

16-
with models.DAG(
33+
# Keyword arguments are generated dynamically at runtime (pylint does not
34+
# know this signature).
35+
with models.DAG( # pylint: disable=unexpected-keyword-arg
1736
dag_id="multi-host-availability-rollback",
1837
start_date=datetime.datetime(2025, 8, 10),
1938
schedule=constants.Schedule.DAILY_PST_6_30PM,
@@ -70,7 +89,11 @@
7089
tpu_topology=config.tpu_topology,
7190
)
7291

73-
with TaskGroup(group_id=f"v{config.tpu_version.value}"):
92+
# Keyword arguments are generated dynamically at runtime (pylint does not
93+
# know this signature).
94+
with TaskGroup( # pylint: disable=unexpected-keyword-arg
95+
group_id=f"v{config.tpu_version.value}"
96+
):
7497
create_node_pool = node_pool.create(
7598
node_pool=node_pool_info,
7699
reservation="cloudtpu-20251107233000-1246578561",
@@ -99,6 +122,8 @@
99122
setups=create_node_pool,
100123
)
101124

125+
# Airflow uses >> for task chaining, which is pointless for pylint.
126+
# pylint: disable=pointless-statement
102127
(
103128
create_node_pool
104129
>> wait_node_pool_available
@@ -107,3 +132,4 @@
107132
>> wait_node_pool_recovered
108133
>> cleanup_node_pool
109134
)
135+
# pylint: enable=pointless-statement

dags/tpu_observability/node_pool_status.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
"""A DAG to validate the status of a GKE node pool through its lifecycle."""
216

317
import copy
@@ -8,12 +22,14 @@
822
from airflow.utils.task_group import TaskGroup
923

1024
from dags.map_reproducibility.utils import constants
11-
from dags.common.vm_resource import Project, Region, Zone
25+
from dags.common.vm_resource import Region, Zone
1226
from dags.tpu_observability.utils import node_pool_util as node_pool
1327
from dags.tpu_observability.configs.common import MachineConfigMap
1428

1529

16-
with models.DAG(
30+
# Keyword arguments are generated dynamically at runtime (pylint does not
31+
# know this signature).
32+
with models.DAG( # pylint: disable=unexpected-keyword-arg
1733
dag_id="gke_node_pool_status",
1834
start_date=datetime.datetime(2025, 8, 1),
1935
schedule=constants.Schedule.DAILY_PST_6PM,
@@ -72,7 +88,11 @@
7288
"WRONG_NODE_LOCATION", default_var=Zone.ASIA_EAST1_C.value
7389
)
7490

75-
with TaskGroup(group_id=f"v{config.tpu_version.value}"):
91+
# Keyword arguments are generated dynamically at runtime (pylint does not
92+
# know this signature).
93+
with TaskGroup( # pylint: disable=unexpected-keyword-arg
94+
group_id=f"v{config.tpu_version.value}"
95+
):
7696
task_id = "create_node_pool"
7797
create_node_pool = node_pool.create.override(task_id=task_id)(
7898
node_pool=node_pool_info,
@@ -129,7 +149,8 @@
129149
)(
130150
node_pool=problematic_node_pool_info,
131151
# The failure is intentionally ignored because we want to validate
132-
# that the status of the node pool (which fails to be created) is "ERROR".
152+
# that the status of the node pool (which fails to be created) is
153+
# "ERROR".
133154
ignore_failure=True,
134155
)
135156

@@ -145,6 +166,8 @@
145166
setups=create_problematic_node_pool_info,
146167
)
147168

169+
# Airflow uses >> for task chaining, which is pointless for pylint.
170+
# pylint: disable=pointless-statement
148171
normal_flow = (
149172
create_node_pool
150173
>> wait_for_provisioning
@@ -162,3 +185,4 @@
162185
>> wait_for_error
163186
>> cleanup_wrong_node_pool
164187
)
188+
# pylint: enable=pointless-statement

0 commit comments

Comments
 (0)