Copilot commented on code in PR #64768:
URL: https://github.com/apache/airflow/pull/64768#discussion_r3059867344
##########
airflow-core/tests/unit/jobs/test_scheduler_job.py:
##########
@@ -3386,6 +3386,37 @@ def test_dagrun_timeout_fails_run(self, dag_maker):
session.rollback()
session.close()
+ def test_dagrun_timeout_emits_run_type_in_stats_tags(self, dag_maker):
+ """
+ Test that dagrun.duration.failed metric includes run_type tag when
failure
+ is caused by dagrun_timeout (regression test for missing run_type tag).
+ """
+ session = settings.Session()
+ with dag_maker(
+ dag_id="test_scheduler_fail_dagrun_timeout_stats",
+ dagrun_timeout=datetime.timedelta(seconds=60),
+ schedule="@daily",
+ session=session,
+ ):
+ EmptyOperator(task_id="dummy")
+
+ dr = dag_maker.create_dagrun(start_date=timezone.utcnow() -
datetime.timedelta(days=1))
+
Review Comment:
`dag_maker.create_dagrun(...)` defaults `run_type` to `DagRunType.MANUAL`
unless explicitly provided (see
`devel-common/src/tests_common/pytest_plugin.py:1118-1120`), so
`schedule="@daily"` here doesn’t make this DagRun “scheduled”. To avoid the
test being misleading (and to better match the reported impact), consider
either passing `run_type=DagRunType.SCHEDULED` and asserting the expected
value, or dropping the `schedule` argument.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]