jason810496 commented on code in PR #55035:
URL: https://github.com/apache/airflow/pull/55035#discussion_r2309708353
##########
airflow-core/src/airflow/utils/log/log_reader.py:
##########
@@ -93,6 +102,22 @@ def read_log_stream(
if try_number is None:
try_number = ti.try_number
+ # Handle no-log cases before hitting read_log_chunks
+ if try_number == 0:
+ state_message = self.get_no_log_state_message(ti)
+ response: dict[str, list[dict[str, str | None]] | None] = {
+ "content": [
+ {
+ "event": state_message,
+ "level": "info",
+ "timestamp": None,
+ }
+ ],
+ "continuation_token": None,
+ }
+ yield json.dumps(response) + "\n"
Review Comment:
Then we can use the similar way to return the logs as normal case.
```suggestion
yield f"{state_message.model_dump_json()}\n"
```
Additionally, instead of checking at `read_log_stream` method, we should
check at `read_log_chunks` method. Since `read_log_stream` will also call from
`read_log_chunks`.
--
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]