This is an automated email from the ASF dual-hosted git repository.

uranusjr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 229e53355d Clarify filename_template deprecation message (#25749)
229e53355d is described below

commit 229e53355d174243a9cb1729b640db592001a393
Author: Tzu-ping Chung <[email protected]>
AuthorDate: Wed Aug 17 07:44:55 2022 +0800

    Clarify filename_template deprecation message (#25749)
---
 airflow/utils/context.pyi              | 2 +-
 airflow/utils/log/file_task_handler.py | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/airflow/utils/context.pyi b/airflow/utils/context.pyi
index 5fb593c839..aba9564b4c 100644
--- a/airflow/utils/context.pyi
+++ b/airflow/utils/context.pyi
@@ -51,7 +51,7 @@ class ConnectionAccessor:
     def get(self, key: str, default_conn: Any = None) -> Any: ...
 
 # NOTE: Please keep this in sync with KNOWN_CONTEXT_KEYS in 
airflow/utils/context.py.
-class Context(TypedDict):
+class Context(TypedDict, total=False):
     conf: AirflowConfigParser
     conn: Any
     dag: DAG
diff --git a/airflow/utils/log/file_task_handler.py 
b/airflow/utils/log/file_task_handler.py
index 041e4778e3..ad05e9447a 100644
--- a/airflow/utils/log/file_task_handler.py
+++ b/airflow/utils/log/file_task_handler.py
@@ -50,8 +50,11 @@ class FileTaskHandler(logging.Handler):
         self.local_base = base_log_folder
         if filename_template is not None:
             warnings.warn(
-                "Passing filename_template to FileTaskHandler is deprecated 
and has no effect",
+                "Passing filename_template to a log handler is deprecated and 
has no effect",
                 DeprecationWarning,
+                # We want to reference the stack that actually instantiates the
+                # handler, not the one that calls super()__init__.
+                stacklevel=(2 if type(self) == FileTaskHandler else 3),
             )
 
     def set_context(self, ti: "TaskInstance"):

Reply via email to