Skip to content

Commit

Permalink
Make new methods private
Browse files Browse the repository at this point in the history
  • Loading branch information
schattian committed Jun 20, 2022
1 parent 9e2b444 commit 5e63221
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions airflow/providers/cncf/kubernetes/utils/pod_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,18 @@ 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]:
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(
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)
dt = self._log_iterable(stream)
if dt is not None:
timestamp.value = dt.timestamp() # type: ignore[attr-defined]

Expand Down Expand Up @@ -257,9 +257,9 @@ def consume_logs(*, since_time: Optional[DateTime] = None, follow: bool = True)
follow=follow,
)
if follow:
timestamp = self.consume_container_logs_stream(pod, container_name, logs)
timestamp = self._consume_container_logs_stream(pod, container_name, logs)
else:
timestamp = self.log_iterable(logs)
timestamp = self._log_iterable(logs)

except BaseHTTPError as e:
self.log.warning(
Expand Down

0 comments on commit 5e63221

Please sign in to comment.