This is an automated email from the ASF dual-hosted git repository.
weilee 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 c0cc614b2d Improve logging in _register_dataset_changes (#41089)
c0cc614b2d is described below
commit c0cc614b2d494d610431fc2796388b86b64af731
Author: Tzu-ping Chung <[email protected]>
AuthorDate: Mon Jul 29 16:13:44 2024 +0800
Improve logging in _register_dataset_changes (#41089)
Logging should be smart enough to render rich objects directly, so we
don't need to format the object string ourselves. This makes the log
messages a little longer, but should be be acceptable.
This also fixed a typo in the message ("did not exists").
---
airflow/models/taskinstance.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/airflow/models/taskinstance.py b/airflow/models/taskinstance.py
index 69bb7b03ff..5b00dba557 100644
--- a/airflow/models/taskinstance.py
+++ b/airflow/models/taskinstance.py
@@ -2996,7 +2996,7 @@ class TaskInstance(Base, LoggingMixin):
if not dataset_obj:
dataset_obj = DatasetModel(uri=uri)
dataset_manager.create_datasets(dataset_models=[dataset_obj],
session=session)
- self.log.warning('Created a new Dataset(uri="%s") as it did
not exists.', uri)
+ self.log.warning("Created a new %r as it did not exist.",
dataset_obj)
dataset_objs_cache[uri] = dataset_obj
for alias in alias_names:
@@ -3007,9 +3007,8 @@ class TaskInstance(Base, LoggingMixin):
extra = {k: v for k, v in extra_items}
self.log.info(
- 'Create dataset event Dataset(uri="%s", extra="%s") through
dataset aliases "%s"',
- uri,
- extra,
+ 'Creating event for %r through aliases "%s"',
+ dataset_obj,
", ".join(alias_names),
)
dataset_manager.register_dataset_change(