From fa4126750151f8d8b8359c0df376e25b0016020e Mon Sep 17 00:00:00 2001 From: Jake Kramer Date: Wed, 24 Jan 2024 16:33:07 -0500 Subject: [PATCH 1/2] Remove superfluous `@Sentry.enrich_errors` from `TaskInstance._schedule_downstream_tasks` A recent refactoring broke the contract `enrich_errors` expect. This decorator is being removed because it's not desired to log Sentry errors for scheduling issues. --- airflow/models/taskinstance.py | 1 - airflow/sentry.py | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/airflow/models/taskinstance.py b/airflow/models/taskinstance.py index 8e6886ea11d22..47a40cefeca11 100644 --- a/airflow/models/taskinstance.py +++ b/airflow/models/taskinstance.py @@ -3227,7 +3227,6 @@ def ti_selector_condition(cls, vals: Collection[str | tuple[str, int]]) -> Colum @classmethod @internal_api_call - @Sentry.enrich_errors @provide_session def _schedule_downstream_tasks( cls, diff --git a/airflow/sentry.py b/airflow/sentry.py index da46f924786df..50f7b019a8ec7 100644 --- a/airflow/sentry.py +++ b/airflow/sentry.py @@ -161,8 +161,7 @@ def enrich_errors(self, func): """ Decorate errors. - Wrap TaskInstance._run_raw_task and LocalTaskJob._run_mini_scheduler_on_child_tasks - to support task specific tags and breadcrumbs. + Wrap TaskInstance._run_raw_task to support task specific tags and breadcrumbs. """ session_args_idx = find_session_idx(func) From f3905e6b9b044ee7446dda7cec24763f32e48ba1 Mon Sep 17 00:00:00 2001 From: Jake Kramer Date: Fri, 26 Jan 2024 15:41:41 -0500 Subject: [PATCH 2/2] Fix incorrect parameter name Resolves MyPy error --- airflow/serialization/pydantic/taskinstance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/serialization/pydantic/taskinstance.py b/airflow/serialization/pydantic/taskinstance.py index 106a31186e585..13760f030d8a3 100644 --- a/airflow/serialization/pydantic/taskinstance.py +++ b/airflow/serialization/pydantic/taskinstance.py @@ -390,7 +390,7 @@ def schedule_downstream_tasks(self, session: Session = NEW_SESSION, max_tis_per_ :meta: private """ return TaskInstance._schedule_downstream_tasks( - ti=self, sessions=session, max_tis_per_query=max_tis_per_query + ti=self, session=session, max_tis_per_query=max_tis_per_query ) def command_as_list(