Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def __init__(
)

self.formatter: logging.Formatter
self.handler: logging.FileHandler | logging.StreamHandler # type: ignore[assignment]
self.handler: logging.FileHandler | logging.StreamHandler
self._doc_type_map: dict[Any, Any] = {}
self._doc_type: list[Any] = []

Expand Down Expand Up @@ -380,11 +380,11 @@ def concat_logs(hits: list[Hit]) -> str:
sources=[host for host in logs_by_host.keys()],
), # type: ignore[call-arg]
StructuredLogMessage(event="::endgroup::"),
] # type: ignore[misc]
]

message = header + [
StructuredLogMessage(event=concat_logs(hits)) for hits in logs_by_host.values()
] # type: ignore[misc]
]
else:
message = [
(host, concat_logs(hits)) # type: ignore[misc]
Expand Down Expand Up @@ -426,7 +426,7 @@ def _es_read(self, log_id: str, offset: int | str, ti: TaskInstance) -> ElasticS

index_patterns = self._get_index_patterns(ti)
try:
max_log_line = self.client.count(index=index_patterns, query=query)["count"] # type: ignore
max_log_line = self.client.count(index=index_patterns, query=query)["count"]
except NotFoundError as e:
self.log.exception("The target index pattern %s does not exist", index_patterns)
raise e
Expand Down Expand Up @@ -513,7 +513,7 @@ def close(self) -> None:

# Reopen the file stream, because FileHandler.close() would be called
# first in logging.shutdown() and the stream in it would be set to None.
if self.handler.stream is None or self.handler.stream.closed: # type: ignore[attr-defined]
if self.handler.stream is None or self.handler.stream.closed:
self.handler.stream = self.handler._open() # type: ignore[union-attr]

# Mark the end of file using end of log mark,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ def get_base_airflow_version_tuple() -> tuple[int, int, int]:

EsLogMsgType = list[StructuredLogMessage] | str
else:
EsLogMsgType = list[tuple[str, str]] # type: ignore[assignment,no-redef,misc]
EsLogMsgType = list[tuple[str, str]] # type: ignore[assignment,misc]

__all__ = ["AIRFLOW_V_3_0_PLUS", "AIRFLOW_V_3_1_PLUS", "BaseHook", "EsLogMsgType"]