jason810496 commented on code in PR #54447:
URL: https://github.com/apache/airflow/pull/54447#discussion_r2297997860


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/log.py:
##########
@@ -160,11 +162,11 @@ def get_log(
     # LogMetadata(TypedDict) is used as type annotation for log_reader; added 
ignore to suppress mypy error
     structured_log_stream, out_metadata = task_log_reader.read_log_chunks(ti, 
try_number, metadata)  # type: ignore[arg-type]
     encoded_token = None
+    log_chunks = list(structured_log_stream)
+    log_chunks.reverse()

Review Comment:
   If we really need this feature, would it be better to add a new UI endpoint 
for this behavior.



##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/log.py:
##########
@@ -146,7 +146,9 @@ def get_log(
 
     if accept == Mimetype.NDJSON:  # only specified application/x-ndjson will 
return streaming response
         # LogMetadata(TypedDict) is used as type annotation for log_reader; 
added ignore to suppress mypy error
-        log_stream = task_log_reader.read_log_stream(ti, try_number, metadata) 
 # type: ignore[arg-type]
+        ndjson_log_stream = list(task_log_reader.read_log_stream(ti, 
try_number, metadata))  # type: ignore[arg-type]
+        reversed_stream = reversed(ndjson_log_stream)
+        log_stream = (line for line in reversed_stream)

Review Comment:
   Reversing logs will be breaking change behavior on public core API.



##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/log.py:
##########
@@ -160,11 +162,11 @@ def get_log(
     # LogMetadata(TypedDict) is used as type annotation for log_reader; added 
ignore to suppress mypy error
     structured_log_stream, out_metadata = task_log_reader.read_log_chunks(ti, 
try_number, metadata)  # type: ignore[arg-type]
     encoded_token = None
+    log_chunks = list(structured_log_stream)
+    log_chunks.reverse()

Review Comment:
   If we really need this feature, would it be better to add a new UI endpoint 
for this behavior?



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