uranusjr commented on code in PR #45914:
URL: https://github.com/apache/airflow/pull/45914#discussion_r1962864643


##########
airflow/www/views.py:
##########
@@ -1716,9 +1716,10 @@ def get_logs_with_metadata(self, session: Session = 
NEW_SESSION):
                 ti.task = dag.get_task(ti.task_id)
 
             if response_format == "json":
-                logs, metadata = task_log_reader.read_log_chunks(ti, 
try_number, metadata)
-                message = logs[0] if try_number is not None else logs
-                return {"message": message, "metadata": metadata}
+                hosts, log_streams, metadata = 
task_log_reader.read_log_chunks(ti, try_number, metadata)
+                host = f"{hosts[0] or ''}\n"

Review Comment:
   Same question, why only `[0]`?



##########
airflow/utils/log/log_reader.py:
##########
@@ -61,9 +62,12 @@ def read_log_chunks(
         contain information about the task log which can enable you read logs 
to the
         end.
         """
-        logs, metadatas = self.log_handler.read(ti, try_number, 
metadata=metadata)
-        metadata = metadatas[0]
-        return logs, metadata
+        hosts: list[str]
+        log_streams: list[Iterable[str]]
+        metadata_array: list[dict[str, Any]]

Review Comment:
   ```suggestion
   ```



##########
airflow/utils/log/log_reader.py:
##########
@@ -84,14 +88,19 @@ def read_log_stream(self, ti: TaskInstance, try_number: int 
| None, metadata: di
             metadata.pop("offset", None)
             metadata.pop("log_pos", None)
             while True:
-                logs, metadata = self.read_log_chunks(ti, current_try_number, 
metadata)
-                for host, log in logs[0]:
-                    yield "\n".join([host or "", log]) + "\n"
+                host: str
+                log_stream: Iterable[str]

Review Comment:
   ```suggestion
   ```



-- 
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]

Reply via email to