Skip to content

Commit

Permalink
Remove TaskContextLogger (apache#43183)
Browse files Browse the repository at this point in the history
It was a fine idea, but we ultimately realized that it's better to just add records to the Log table.  These are now easy to find through the UI (see event logs).
  • Loading branch information
dstandish authored and ellisms committed Nov 13, 2024
1 parent 53068bb commit 8472393
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 348 deletions.
12 changes: 0 additions & 12 deletions airflow/config_templates/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1032,18 +1032,6 @@ logging:
type: boolean
example: ~
default: "False"
enable_task_context_logger:
description: |
If enabled, Airflow may ship messages to task logs from outside the task run context, e.g. from
the scheduler, executor, or callback execution context. This can help in circumstances such as
when there's something blocking the execution of the task and ordinarily there may be no task
logs at all.
This is set to ``True`` by default. If you encounter issues with this feature
(e.g. scheduler performance issues) it can be disabled.
version_added: 2.8.0
type: boolean
example: ~
default: "True"
color_log_error_keywords:
description: |
A comma separated list of keywords related to errors whose presence should display the line in red
Expand Down
5 changes: 0 additions & 5 deletions airflow/utils/log/file_task_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from __future__ import annotations

import inspect
import logging
import os
from contextlib import suppress
Expand Down Expand Up @@ -238,10 +237,6 @@ def set_context(self, ti: TaskInstance, *, identifier: str | None = None) -> Non
self.handler.setLevel(self.level)
return SetContextPropagate.MAINTAIN_PROPAGATE if self.maintain_propagate else None

@cached_property
def supports_task_context_logging(self) -> bool:
return "identifier" in inspect.signature(self.set_context).parameters

@staticmethod
def add_triggerer_suffix(full_path, job_id=None):
"""
Expand Down
188 changes: 0 additions & 188 deletions airflow/utils/log/task_context_logger.py

This file was deleted.

5 changes: 5 additions & 0 deletions newsfragments/43183.significant.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Remove TaskContextLogger

We introduced this as a way to inject messages into task logs from places
other than the task execution context. We later realized that we were better off
just using the Log table.
2 changes: 1 addition & 1 deletion providers/src/airflow/providers/amazon/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ Misc
.. Below changes are excluded from the changelog. Move them to
appropriate section above if needed. Do not delete the lines(!):
* ``Use reproducible builds for provider packages (#35693)``
* ``Update http to s3 system test (#35711)``
* ``Update http to s3 system test (#35711)``
8.11.0
......
Expand Down
139 changes: 0 additions & 139 deletions tests/utils/log/test_task_context_logger.py

This file was deleted.

4 changes: 1 addition & 3 deletions tests_common/test_utils/mock_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from __future__ import annotations

from collections import defaultdict
from unittest.mock import MagicMock, Mock
from unittest.mock import MagicMock

from airflow.executors.base_executor import BaseExecutor
from airflow.executors.executor_utils import ExecutorName
Expand Down Expand Up @@ -52,8 +52,6 @@ def __init__(self, do_update=True, *args, **kwargs):

super().__init__(*args, **kwargs)

self.task_context_logger = Mock()

def success(self):
return State.SUCCESS

Expand Down

0 comments on commit 8472393

Please sign in to comment.