Skip to content

Commit 779647c

Browse files
committed
Reintroduce the "validate_jobset_replica_number" function in the jobset_util.py file
Refactor for new DAG formatting
1 parent f2f4e06 commit 779647c

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

dags/tpu_observability/jobset_healthiness_ready.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,8 @@ def generate_second_node_pool_name(
144144

145145
start_workload = jobset.run_workload(
146146
node_pool=cluster_info,
147-
yaml_config=jobset_config.generate_yaml(
148-
workload_script=Workload.IDLE_READY_TPU_20M
149-
),
150-
namespace=jobset_config.namespace,
147+
jobset_config=jobset_config,
148+
workload_type=Workload.IDLE_READY_TPU_20M,
151149
)
152150

153151
validate_ready_replicas = jobset.validate_jobset_replica_number(
@@ -161,8 +159,7 @@ def generate_second_node_pool_name(
161159
task_id="cleanup_workload", trigger_rule=TriggerRule.ALL_DONE
162160
)(
163161
node_pool=cluster_info,
164-
jobset_name=jobset_config.jobset_name,
165-
namespace=jobset_config.namespace,
162+
jobset_config=jobset_config,
166163
).as_teardown(
167164
setups=start_workload
168165
)

dags/tpu_observability/utils/jobset_util.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,3 +882,17 @@ def ensure_no_jobset_uptime_data(
882882
logging.info("Stability period passed with no data detected.")
883883
return True
884884
return False
885+
886+
887+
@task.sensor(poke_interval=30, timeout=900, mode="reschedule")
888+
def validate_jobset_replica_number(
889+
node_pool: node_pool_info,
890+
jobset_config: JobSet,
891+
replica_type: str,
892+
correct_replica_num: int,
893+
):
894+
name = jobset_config.replicated_job_name
895+
found_replica_number = get_replica_num(
896+
replica_type=replica_type, job_name=name, node_pool=node_pool
897+
)
898+
return found_replica_number == correct_replica_num

0 commit comments

Comments
 (0)