dstandish commented on code in PR #23658:
URL: https://github.com/apache/airflow/pull/23658#discussion_r895937987
##########
airflow/providers/cncf/kubernetes/utils/pod_manager.py:
##########
@@ -193,6 +195,40 @@ def follow_container_logs(self, pod: V1Pod,
container_name: str) -> PodLoggingSt
)
return self.fetch_container_logs(pod=pod,
container_name=container_name, follow=True)
+ def log_iterable(self, logs: Iterable[bytes]) -> Optional[DateTime]:
+ timestamp = None
+ for line in logs:
+ timestamp, message = self.parse_log_line(line.decode('utf-8',
errors="backslashreplace"))
+ self.log.info(message)
+ return timestamp
+
+ def consume_container_logs_stream(
+ self, pod: V1Pod, container_name: str, stream: Iterable[bytes]
+ ) -> Optional[DateTime]:
+ def log_iterable_and_set_value(timestamp):
+ dt = self.log_iterable(stream)
+ if dt is not None:
+ timestamp.value = dt.timestamp() # type: ignore[attr-defined]
Review Comment:
ok but when this value is returned by consume_logs, you must ensure that it
is converted back to DateTime right? perhaps you have done that somewhere?
--
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]