@@ -62,27 +62,10 @@ def assert_metric(role, metric):
6262
6363# Wait for the metrics to be consumed by the statsd-exporter
6464time .sleep (5 )
65- # Test the DAG in a loop. Each time we call the script a new job will be started: we can avoid
66- # or minimize this by looping over the check instead.
67- iterations = 9
68- loop = 0
69- while True :
70- try :
71- logging .info (f"Response code: { response .status_code } " )
72- assert response .status_code == 200 , "DAG run could not be triggered."
73- # Worker is not deployed with the kubernetes executor so retrieve success metric from scheduler
74- # (disable line-break flake checks)
75- if (assert_metric ("scheduler" , "airflow_scheduler_heartbeat" )) and (
76- assert_metric (
77- "scheduler" , "airflow_dagrun_duration_success_sparkapp_dag_count"
78- )
79- ): # noqa: W503, W504
80- break
81- time .sleep (10 )
82- loop += 1
83- if loop == iterations :
84- logging .error ("Still waiting for metrics. Exiting to start a new loop...." )
85- # force re-try of script
86- sys .exit (1 )
87- except AssertionError as error :
88- logging .warning (f"Encountered: { error } " )
65+
66+ logging .info (f"Response code: { response .status_code } " )
67+ assert response .status_code == 200 , "DAG run could not be triggered."
68+ # Worker is not deployed with the kubernetes executor so retrieve success metric from scheduler
69+ # (disable line-break flake checks)
70+ assert_metric ("scheduler" , "airflow_scheduler_heartbeat" )
71+ assert_metric ("scheduler" , "airflow_dagrun_duration_success_sparkapp_dag_count" )
0 commit comments