Prasanth345 opened a new pull request, #55035:
URL: https://github.com/apache/airflow/pull/55035
### Summary
This PR ensures consistent handling of **no-log cases** for tasks when
`try_number=0`.
Instead of returning empty or confusing responses, the system now provides
clear, structured messages across both **UI** and **API** log views.
### Implementation Details
- Added a check for `try_number=0` before calling `read_log_chunks`.
- Introduced fallback structured log responses for specific states:
- **SKIPPED** → "Task was skipped — no logs available."
- **UPSTREAM_FAILED** → "Task did not run because upstream task(s) failed."
- Others → "No logs available for this task."
- Reused structured log format to match API/UI expectations (timestamp,
event, level, sources).
- Ensured this logic is applied consistently in log streaming and API
responses.
### Testing
- Verified DAG runs where tasks were **SKIPPED** and **UPSTREAM_FAILED**.
- Confirmed that API responses now return structured fallback logs instead
of empty logs.
- Checked that UI log viewer shows the same messages, ensuring consistency.
### Why
Previously, tasks with `try_number=0` produced inconsistent log responses:
- API often returned empty logs.
- UI displayed misleading or missing messages.
This change standardizes the behavior, improving observability and debugging
for users.
### Related Issue
Closes https://github.com/apache/airflow/issues/54749
--
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]