Skip to content

feat: Apply TaskGroupWithTimeout for TPU Observability DAGs - part 1 - #262

Merged
alfredyu-cienet merged 6 commits into
tpu-obs/release/pr-262from
tpu-obs/user/yuna/taskgroup_timeout
Jul 1, 2026
Merged

feat: Apply TaskGroupWithTimeout for TPU Observability DAGs - part 1#262
alfredyu-cienet merged 6 commits into
tpu-obs/release/pr-262from
tpu-obs/user/yuna/taskgroup_timeout

Conversation

@yuna-tzeng

@yuna-tzeng yuna-tzeng commented May 21, 2026

Copy link
Copy Markdown

Description

This PR integrates TaskGroupWithTimeout directly into all GKE Node Pool validation DAGs that are unrelated to JobSets/workloads. This ensures strict stage-specific timeout enforcement across different phases (Pre-test provisioning: 10 mins, Post-test cleanup: 10 mins, and the remaining budget allocated to the main test case).

DAGs Refactored with TaskGroupWithTimeout

The following 5 GKE Node Pool status and label validation DAGs have been successfully refactored into separate pre_test, test, and post_test blocks under TaskGroupWithTimeout:

  • dags/tpu_observability/node_pool_status.py
  • dags/tpu_observability/node_pool_ttr_disk_size.py
  • dags/tpu_observability/node_pool_ttr_update_label.py
  • dags/tpu_observability/multi_host_nodepool_rollback_dag.py
  • dags/tpu_observability/update_node_pool_label.py

Deferred DAGs (Unchanged)

Because TaskGroupWithTimeout does not support nested TaskGroups, GKE DAGs that involve JAX workloads and rely on jobset.create_jobset_startup_group() cannot be refactored yet. The helper function internally instantiates a standard TaskGroup (jobset_startup_and_prepare), which triggers a parsing-time AirflowFailException when nested inside a parent TaskGroupWithTimeout.

As a result, the following JobSet and workload-related DAGs are temporarily left unchanged using original TaskGroups, to be refactored once nested TaskGroups are natively supported:

  • dags/tpu_observability/jobset_ttr_drain_restart.py
  • dags/tpu_observability/jobset_ttr_node_pool_resize.py
  • dags/tpu_observability/jobset_ttr_pod_delete.py
  • dags/tpu_observability/jobset_ttr_rollback.py
  • dags/tpu_observability/jobset_ttr_kill_process.py
  • dags/tpu_observability/jobset_uptime_validation.py
  • dags/tpu_observability/tpu_sdk_monitoring_validation_dag.py
  • dags/tpu_observability/tpu_info_metrics_dag.py
  • dags/tpu_observability/tpu_info_format_validation_dags.py

Key Changes & Mechanisms

Timeout Budgets:

  • PRE_TEST_TIMEOUT: 10 minutes
  • POST_TEST_TIMEOUT: 10 minutes
  • TEST_TIMEOUT: Evaluated dynamically as DAGRUN_TIMEOUT - 20 minutes
  • Guaranteed Cleanup: The post_test block in the refactored DAGs utilizes is_teardown=True under the hood, ensuring that GKE node pool deletions are executed even if upstream test cases timeout or fail, preventing accidental resource leakages.

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run one-shot tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed.

@alfredyu-cienet

Copy link
Copy Markdown
Collaborator

first scan OK
will do a second scan next week

@alfredyu-cienet alfredyu-cienet changed the title feat(tpu_observability): integrate TaskGroupWithTimeout into jobset-u… feat: Apply TaskGroupWithTimeout for TPU Observability DAGs - part 1 May 26, 2026
Comment on lines +172 to +184
# Intentionally create a node pool with problematic configurations
# to validate that it enters the ERROR state.
task_id = "create_problematic_node_pool_info"
create_problematic_node_pool_info = node_pool.create.override(
task_id=task_id,
owner=test_owner.YUNA_T,
)(
node_pool=problematic_node_pool_info,
# The failure is intentionally ignored because we want to validate
# that the status of the node pool (which fails to be created) is
# "ERROR".
ignore_failure=True,
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be in pre-test

)

task_id = "wait_for_error"
wait_for_error = node_pool.wait_for_status.override(task_id=task_id)(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
wait_for_error = node_pool.wait_for_status.override(task_id=task_id)(
validate_problematic_node_pool_enter_error_state = node_pool.wait_for_status.override(task_id=task_id)(

@alfredyu-cienet

Copy link
Copy Markdown
Collaborator

ditto #264 (comment)

@alfredyu-cienet
alfredyu-cienet force-pushed the dev branch 4 times, most recently from 4af284a to a9fa8fb Compare June 8, 2026 08:58
@alfredyu-cienet
alfredyu-cienet force-pushed the dev branch 3 times, most recently from cd8b06c to d4c530a Compare June 12, 2026 07:31
@yuna-tzeng
yuna-tzeng force-pushed the tpu-obs/user/yuna/taskgroup_timeout branch 2 times, most recently from e784d2e to 71043b8 Compare June 12, 2026 09:42
@alfredyu-cienet
alfredyu-cienet force-pushed the dev branch 2 times, most recently from 00a4856 to fdcbae9 Compare June 18, 2026 00:43
@yuna-tzeng
yuna-tzeng force-pushed the tpu-obs/user/yuna/taskgroup_timeout branch from 71043b8 to e683b6e Compare June 26, 2026 03:38
…nrelated GKE DAGs

Integrates `TaskGroupWithTimeout` directly into all TPU Observability
DAGs that do not depend on Kubernetes JobSets. This provides strict,
shared deadline timeout enforcement across distinct stages of GKE node
pool validation.

Specifically:
1. Configures stage-specific timeouts for all modified DAGs:
   - `PRE_TEST_TIMEOUT`: 10 minutes (for GKE provisioning and availability setup)
   - `POST_TEST_TIMEOUT`: 10 minutes (for GKE teardown and cleanup)
   - `TEST_TIMEOUT`: Evaluates dynamically as `DAGRUN_TIMEOUT - 20 mins`

2. Restructures the following 5 DAGs into three separate `TaskGroupWithTimeout` blocks:
   - `dags/tpu_observability/node_pool_status.py`
   - `dags/tpu_observability/node_pool_ttr_disk_size.py`
   - `dags/tpu_observability/node_pool_ttr_update_label.py`
   - `dags/tpu_observability/multi_host_nodepool_rollback_dag.py`
   - `dags/tpu_observability/update_node_pool_label.py`

3. Refactors GKE node pool operations into:
   - `pre_test`: Handles node pool creation and waiting for provisioning/running.
   - `test`: Executes the core test mutation and verification flow.
   - `post_test`: Manages cleanup/teardown of GKE node pools (using `is_teardown=True`
     to guarantee execution even if upstream stages timeout or fail).
…upWithTimeout

Refactors five TPU observability DAGs to use TaskGroupWithTimeout for proper timeout
management during pre-test setup, test execution, and post-test teardown. This aligns
their implementation pattern with node_pool_status.py.

Specifically, this change:
- Imports TaskGroupWithTimeout in each DAG.
- Defines PRE_TEST_TIMEOUT, TEST_TIMEOUT, and POST_TEST_TIMEOUT at the module level.
- Groups tasks into pre_test, test, and post_test TaskGroupWithTimeout blocks.
- Chains tasks sequentially within each group and updates the overall DAG chain.

Modified DAGs:
- dags/tpu_observability/jobset_ttr_drain_restart.py
- dags/tpu_observability/jobset_ttr_node_pool_resize.py
- dags/tpu_observability/jobset_ttr_pod_delete.py
- dags/tpu_observability/jobset_ttr_rollback.py
- dags/tpu_observability/jobset_uptime_validation.py
@yuna-tzeng
yuna-tzeng force-pushed the tpu-obs/user/yuna/taskgroup_timeout branch from 5f57ff6 to b70dc15 Compare June 29, 2026 03:37
@alfredyu-cienet
alfredyu-cienet changed the base branch from dev to tpu-obs/release/pr-262 July 1, 2026 07:39
@alfredyu-cienet
alfredyu-cienet merged commit 08fa8b2 into tpu-obs/release/pr-262 Jul 1, 2026
10 checks passed
@alfredyu-cienet
alfredyu-cienet deleted the tpu-obs/user/yuna/taskgroup_timeout branch July 1, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants