dstandish commented on code in PR #32646:
URL: https://github.com/apache/airflow/pull/32646#discussion_r1266298943
##########
airflow/utils/log/file_task_handler.py:
##########
@@ -182,14 +184,38 @@ def set_context(self, ti: TaskInstance) -> None |
SetContextPropagate:
functionality is only used in unit testing.
:param ti: task instance object
+ :param identifier: if set, adds suffix to log file. For use when
shipping exceptional messages
+ to task logs from context other than task or trigger run
"""
- local_loc = self._init_file(ti)
+ local_loc = self._init_file(ti, identifier=identifier)
self.handler = NonCachingFileHandler(local_loc, encoding="utf-8")
if self.formatter:
self.handler.setFormatter(self.formatter)
self.handler.setLevel(self.level)
return SetContextPropagate.MAINTAIN_PROPAGATE if
self.maintain_propagate else None
+ @cached_property
+ def _supports_arbitrary_ship(self):
+ return "identifier" in inspect.signature(self.set_context).parameters
+
+ def ship_arbitrary_message(
Review Comment:
do does this make more sense here or on the TaskLogShipper class???
##########
airflow/utils/log/file_task_handler.py:
##########
@@ -182,14 +184,38 @@ def set_context(self, ti: TaskInstance) -> None |
SetContextPropagate:
functionality is only used in unit testing.
:param ti: task instance object
+ :param identifier: if set, adds suffix to log file. For use when
shipping exceptional messages
+ to task logs from context other than task or trigger run
"""
- local_loc = self._init_file(ti)
+ local_loc = self._init_file(ti, identifier=identifier)
self.handler = NonCachingFileHandler(local_loc, encoding="utf-8")
if self.formatter:
self.handler.setFormatter(self.formatter)
self.handler.setLevel(self.level)
return SetContextPropagate.MAINTAIN_PROPAGATE if
self.maintain_propagate else None
+ @cached_property
+ def _supports_arbitrary_ship(self):
+ return "identifier" in inspect.signature(self.set_context).parameters
+
+ def ship_arbitrary_message(
Review Comment:
does this make more sense here or on the TaskLogShipper class???
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]