Skip to content

Commit f092e41

Browse files
committed
feat: Refactor streaming rate validation to create dynamic task groups for each rate
1 parent f80a789 commit f092e41

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

dags/tpu_observability/tpu_info_streaming_rate.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def validate_streaming_rate(info, pod_name: str, rate: float) -> str:
6767
duration = 15
6868

6969
tpu_args = (
70-
f"sh -c \"script -q -c 'timeout {duration}s tpu-info --streaming --rate {rate}' /dev/null\" "
70+
f"sh -c \"script -q -c 'timeout {duration}s "
71+
f"tpu-info --streaming --rate {rate}' /dev/null\" "
7172
f"|| [ $? -eq 124 ]"
7273
)
7374
output = execute_tpu_info_cli_command(info, pod_name, tpu_args)
@@ -187,21 +188,20 @@ def generate_second_node_pool_name(
187188
task_id="wait_for_job_start"
188189
)(cluster_info, pod_name_list=pod_names, job_apply_time=apply_time)
189190

190-
# Keyword arguments are generated dynamically at runtime (pylint does not
191-
# know this signature).
192-
with TaskGroup( # pylint: disable=unexpected-keyword-arg
193-
group_id="verification_group"
194-
) as verification_group:
195-
test_rates = [0.1, 0.5, 1.0, 5.0]
196-
197-
streaming_validation_results = (
198-
validate_streaming_rate.override(task_id="streaming_rate_test")
199-
.partial(info=cluster_info)
200-
.expand(
201-
pod_name=pod_names,
202-
rate=test_rates,
203-
)
204-
)
191+
test_rates = [0.1, 0.5, 1.0, 5.0]
192+
for rate in test_rates:
193+
formatted_rate = str(rate).replace(".", "_")
194+
195+
# Keyword arguments are generated dynamically at runtime (pylint does not
196+
# know this signature).
197+
with TaskGroup( # pylint: disable=unexpected-keyword-arg
198+
group_id=f"verification_group_rate_{formatted_rate}"
199+
) as rate_group:
200+
streaming_validation_results = (
201+
validate_streaming_rate.override(task_id="streaming_rate_test")
202+
.partial(info=cluster_info, rate=rate)
203+
.expand(pod_name=pod_names)
204+
)
205205

206206
cleanup_workload = jobset.end_workload.override(
207207
task_id="cleanup_workload", trigger_rule=TriggerRule.ALL_DONE

0 commit comments

Comments
 (0)