Skip to content

Commit 2a06e27

Browse files
authored
Check attr on parent not self re TaskContextLogger set_context (#35780)
To know whether we should supply `identifier` param, need to check parent class.
1 parent 379b7c0 commit 2a06e27

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

airflow/providers/amazon/aws/log/s3_task_handler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ def hook(self):
7878
)
7979

8080
def set_context(self, ti: TaskInstance, *, identifier: str | None = None) -> None:
81-
if getattr(self, "supports_task_context_logging", False):
81+
# todo: remove-at-min-airflow-version-2.8
82+
# after Airflow 2.8 can always pass `identifier`
83+
if getattr(super(), "supports_task_context_logging", False):
8284
super().set_context(ti, identifier=identifier)
8385
else:
8486
super().set_context(ti)

airflow/providers/elasticsearch/log/es_task_handler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,9 @@ def set_context(self, ti: TaskInstance, *, identifier: str | None = None) -> Non
443443
self.handler.setLevel(self.level)
444444
self.handler.setFormatter(self.formatter)
445445
else:
446-
if getattr(self, "supports_task_context_logging", False):
446+
# todo: remove-at-min-airflow-version-2.8
447+
# after Airflow 2.8 can always pass `identifier`
448+
if getattr(super(), "supports_task_context_logging", False):
447449
super().set_context(ti, identifier=identifier)
448450
else:
449451
super().set_context(ti)

airflow/providers/google/cloud/log/gcs_task_handler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ def client(self) -> storage.Client:
142142
)
143143

144144
def set_context(self, ti: TaskInstance, *, identifier: str | None = None) -> None:
145-
if getattr(self, "supports_task_context_logging", False):
145+
# todo: remove-at-min-airflow-version-2.8
146+
# after Airflow 2.8 can always pass `identifier`
147+
if getattr(super(), "supports_task_context_logging", False):
146148
super().set_context(ti, identifier=identifier)
147149
else:
148150
super().set_context(ti)

airflow/providers/microsoft/azure/log/wasb_task_handler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ def hook(self):
9696
return None
9797

9898
def set_context(self, ti: TaskInstance, *, identifier: str | None = None) -> None:
99-
if getattr(self, "supports_task_context_logging", False):
99+
# todo: remove-at-min-airflow-version-2.8
100+
# after Airflow 2.8 can always pass `identifier`
101+
if getattr(super(), "supports_task_context_logging", False):
100102
super().set_context(ti, identifier=identifier)
101103
else:
102104
super().set_context(ti)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy