-
Notifications
You must be signed in to change notification settings - Fork 17.1k
Clarify logging_config_class and deprecate ES/OS implicit REMOTE_TASK_LOG registration
#66994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
jason810496
wants to merge
7
commits into
apache:main
from
jason810496:refactor/logging/clarify-logging-config-class
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
99a22a2
Clarify the purpose of logging_class_path
jason810496 a2ad476
Deprecate implicit registration of REMOTE_TASK_LOG in Elasticsearch a…
jason810496 1a46098
CI: Fix OS and ES tests
jason810496 bf826fc
Move missing-REMOTE_TASK_LOG warning to after dictConfig
jason810496 dfb5049
Add ES docs and move the confest into test modules
jason810496 43f228c
Clarify the ES provider matrix in Docs
jason810496 ef217fc
fixup: Fix ES and OS compat tests
jason810496 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| from __future__ import annotations | ||
|
|
||
| from unittest import mock | ||
|
|
||
| import pytest | ||
|
|
||
| from airflow.logging_config import ( | ||
| DEFAULT_LOGGING_CONFIG_PATH, | ||
| _ActiveLoggingConfig, | ||
| _warn_if_missing_remote_task_log, | ||
| ) | ||
|
|
||
|
|
||
| class TestWarnIfMissingRemoteTaskLog: | ||
| @pytest.fixture(autouse=True) | ||
| def _reset_active_logging_config(self, monkeypatch): | ||
| monkeypatch.setattr(_ActiveLoggingConfig, "remote_task_log", None, raising=False) | ||
| monkeypatch.setattr(_ActiveLoggingConfig, "logging_config_loaded", True, raising=False) | ||
|
|
||
| def test_warns_when_user_module_missing_remote_task_log_and_remote_logging_enabled(self, monkeypatch): | ||
| monkeypatch.setenv("AIRFLOW__LOGGING__REMOTE_LOGGING", "True") | ||
| with mock.patch("airflow.logging_config.log") as mock_log: | ||
| _warn_if_missing_remote_task_log("my_pkg.custom_settings.LOGGING_CONFIG") | ||
| mock_log.warning.assert_called_once() | ||
| assert "my_pkg.custom_settings" in mock_log.warning.call_args.args | ||
|
|
||
| def test_no_warning_when_using_fallback_path(self, monkeypatch): | ||
| monkeypatch.setenv("AIRFLOW__LOGGING__REMOTE_LOGGING", "True") | ||
| with mock.patch("airflow.logging_config.log") as mock_log: | ||
| _warn_if_missing_remote_task_log(DEFAULT_LOGGING_CONFIG_PATH) | ||
| mock_log.warning.assert_not_called() | ||
|
|
||
| def test_no_warning_when_remote_logging_disabled(self, monkeypatch): | ||
| monkeypatch.setenv("AIRFLOW__LOGGING__REMOTE_LOGGING", "False") | ||
| with mock.patch("airflow.logging_config.log") as mock_log: | ||
| _warn_if_missing_remote_task_log("my_pkg.custom_settings.LOGGING_CONFIG") | ||
| mock_log.warning.assert_not_called() | ||
|
|
||
| def test_no_warning_when_remote_task_log_is_set(self, monkeypatch): | ||
| monkeypatch.setenv("AIRFLOW__LOGGING__REMOTE_LOGGING", "True") | ||
| monkeypatch.setattr(_ActiveLoggingConfig, "remote_task_log", object(), raising=False) | ||
| with mock.patch("airflow.logging_config.log") as mock_log: | ||
| _warn_if_missing_remote_task_log("my_pkg.custom_settings.LOGGING_CONFIG") | ||
| mock_log.warning.assert_not_called() | ||
|
|
||
| def test_no_warning_when_empty_logging_class_path(self, monkeypatch): | ||
| monkeypatch.setenv("AIRFLOW__LOGGING__REMOTE_LOGGING", "True") | ||
| with mock.patch("airflow.logging_config.log") as mock_log: | ||
| _warn_if_missing_remote_task_log("") | ||
| mock_log.warning.assert_not_called() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure do I need to update the Changelog myself at this stage?