seanghaeli opened a new pull request, #73580:
URL: https://github.com/apache/airflow/pull/73580

   
   ## Summary
   
   When a deadline is missed and its callback fires, the callback's execution 
logs are now viewable from the UI. The deadline status on the Dag Run view gets 
a Callback Logs button that opens the logs in a modal, rendered through the 
same pipeline as task instance logs.
   
   - New endpoint `GET 
/ui/dags/{dag_id}/dagRuns/{dag_run_id}/callbacks/{callback_id}/logs` returning 
JSON or streamed NDJSON, following the task instance log route pattern. Logs 
are read from remote storage when configured, falling back to the local log 
folder, at the `executor_callbacks/...` and `triggerer_callbacks/...` paths 
written since #66379.
   - `DeadlineResponse` gains `callback_id` and `callback_state` so the UI can 
link a deadline to its callback.
   - The triggerer routes callback trigger output to the 
`triggerer_callbacks/...` log path so async callback logs are also retrievable.
   - New `CallbackLogViewer` component wired into the deadline display on the 
Dag Run view, both the inline single deadline case and the multiple deadlines 
modal. It reuses the existing `parseLogs` pipeline and `StateBadge`.
   
   Callbacks can act on a deadline miss, so users need to see what the callback 
did. Kaxil requested this during the deadlines UI work: "Some way to know if a 
deadline didn't fire and it failed: something on UI would be great, like Task 
log."
   
   This supersedes #66610 and addresses the review feedback from it: streamed 
NDJSON to avoid buffering large logs in the API server, a single exists-only 
query that also verifies the callback belongs to the requested dag run, path 
validation at the Depends level, `CallbackState` typing on the datamodel, reuse 
of the existing log parsing and badge components in the UI, and path traversal 
hardening (path component validation plus a realpath containment check) for the 
CodeQL findings.
   
   ## E2E verification
   
   Verified in breeze with the full stack (scheduler, dag-processor, triggerer, 
API server, LocalExecutor, postgres). A Dag with a `SyncCallback` DeadlineAlert 
was parsed, unpaused, and triggered; the deadline missed naturally while the 
task ran, the callback executed through the callback supervisor, and its logs 
came back through the new endpoint in both JSON and NDJSON form. The 
screenshots below are from that live run.
   
   Dag Run view with a missed deadline and the Callback Logs button:
   
   ![Dag Run deadline 
status](https://raw.githubusercontent.com/aws-mwaa/upstream-to-airflow/callback-log-ui-screenshots/dag_run_deadline_status.png)
   
   Callback logs modal with the callback state badge and the structured logs:
   
   ![Callback logs 
modal](https://raw.githubusercontent.com/aws-mwaa/upstream-to-airflow/callback-log-ui-screenshots/callback_logs_modal.png)
   
   A run with two named deadlines, each with its own Callback Logs button in 
the deadlines modal:
   
   ![Multiple deadlines 
modal](https://raw.githubusercontent.com/aws-mwaa/upstream-to-airflow/callback-log-ui-screenshots/deadline_modal_multiple.png)
   
   ![Callback logs from the multiple deadlines 
modal](https://raw.githubusercontent.com/aws-mwaa/upstream-to-airflow/callback-log-ui-screenshots/callback_logs_modal_multi.png)
   
   ## Tests
   
   - `airflow-core/tests/unit/utils/log/test_callback_log_reader.py` and 
`airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_deadlines.py`: 75 
passed in breeze.
   - `airflow-core/tests/unit/jobs/test_triggerer_job.py`: 118 passed in breeze.
   - `pnpm lint` (eslint and tsc) and the Run page vitest suites pass; mypy 
clean on the touched core files.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Fable 5)
   
   Generated-by: Claude Code (Fable 5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


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