Skip to content

Add API endpoint and UI for deadline callback log visibility#66610

Open
seanghaeli wants to merge 6 commits into
apache:mainfrom
aws-mwaa:ghaeli/callback-log-ui-visibility
Open

Add API endpoint and UI for deadline callback log visibility#66610
seanghaeli wants to merge 6 commits into
apache:mainfrom
aws-mwaa:ghaeli/callback-log-ui-visibility

Conversation

@seanghaeli

@seanghaeli seanghaeli commented May 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Make deadline callback logs visible in the Airflow UI. When a deadline is missed and a callback fires, users can now view the callback's execution logs directly from the web interface.

Changes

Backend:

  • New CallbackLogReader utility (airflow-core/src/airflow/utils/log/callback_log_reader.py) — reads callback logs from remote or local storage using the same RemoteLogIO infrastructure as task logs
  • New API endpoint GET /ui/dags/{dag_id}/dagRuns/{dag_run_id}/callbacks/{callback_id}/logs on the deadlines UI router
  • Updated DeadlineResponse datamodel — added callback_id and callback_state fields

Frontend:

  • CallbackLogViewer.tsx component — fetches and displays callback execution logs in a modal dialog
  • Simplified deadline status display: inline "Missed" badge + "Callback Logs" button + expected/actual times (no success badge, no "Finished late" text, no alert name)

Motivation

Kaxil requested this: "Some way to know if a deadline didn't fire and it failed: something on UI would be great, like Task log. If deadlines are visible, it would be even better experience than previous SLAs."

Dependencies


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.6)

Generated-by: Claude Code (Opus 4.6) following the guidelines

End-to-End Verification

Verified in breeze with full Airflow stack (scheduler + dag-processor + triggerer + API server + LocalExecutor). A test DAG with a SyncCallback deadline was parsed, unpaused, scheduled, and the deadline missed naturally. The callback executed through supervise_callback() and produced real structured logs.

Dag Run Page — Deadline Status with Callback

Deadline Status in Dag Run

Callback Logs Modal

Callback Logs Modal

Verified:

  • 6/6 API unit tests pass (test_callback_logs.py)
  • 12/12 log reader unit tests pass (test_callback_log_reader.py)
  • Path traversal protection via regex validation + os.path.commonpath containment check
  • Stress tested with 10K-100K line logs: 10K lines renders in 0.23s, acceptable for realistic callback output

@boring-cyborg boring-cyborg Bot added area:API Airflow's REST/HTTP API area:logging labels May 8, 2026
Comment thread airflow-core/src/airflow/utils/log/callback_log_reader.py Fixed
@seanghaeli seanghaeli force-pushed the ghaeli/callback-log-ui-visibility branch from 2b1e618 to 9102967 Compare May 13, 2026 22:37
Comment thread airflow-core/src/airflow/utils/log/callback_log_reader.py Fixed
@seanghaeli seanghaeli force-pushed the ghaeli/callback-log-ui-visibility branch 9 times, most recently from e303ead to f6103b3 Compare May 23, 2026 17:36
Comment thread airflow-core/src/airflow/utils/log/callback_log_reader.py Fixed
@vincbeck

Copy link
Copy Markdown
Contributor

I like the interface but I would like to have @bbovenzi opinion on this one

@seanghaeli seanghaeli force-pushed the ghaeli/callback-log-ui-visibility branch 2 times, most recently from e8a1b93 to 528ce64 Compare June 5, 2026 19:24
@seanghaeli seanghaeli requested a review from o-nikolas as a code owner June 5, 2026 21:21
@seanghaeli seanghaeli force-pushed the ghaeli/callback-log-ui-visibility branch 3 times, most recently from 368fb19 to 8ce33e6 Compare June 8, 2026 20:44
@ashb

ashb commented Jun 10, 2026

Copy link
Copy Markdown
Member

Why is the callback logs a modal, rather than a tab? (I'm not saying it's wrong, I would just like to know your thinking and what made you chose this over another option)

Additionally we should likely use the existing log component so that it gets the same filtering, formatting, and grouping, not just displayed as plain text.

@seanghaeli

Copy link
Copy Markdown
Contributor Author

@ashb I thought about making the logs appear in a new tab next to Details where the rest of the logs are, but this page only appears when a deadline is missed, so grouping it up with the “Deadline Missed” section makes more spatial sense in my opinion.

@seanghaeli seanghaeli force-pushed the ghaeli/callback-log-ui-visibility branch from 6ab1317 to 1c8fc49 Compare June 10, 2026 14:54
@seanghaeli

Copy link
Copy Markdown
Contributor Author

@ashb updated to use TaskLogContent

@seanghaeli seanghaeli closed this Jun 11, 2026
@seanghaeli seanghaeli reopened this Jun 11, 2026
@seanghaeli seanghaeli force-pushed the ghaeli/callback-log-ui-visibility branch from ddaab67 to 7567838 Compare June 12, 2026 16:47

@SameerMesiah97 SameerMesiah97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not inspected the diff itself, but I saw your dev list post requesting feedback on potential UI additions.

Overall, I think you've covered most of what users would reasonably expect to see for DeadlineAlerts in the UI. One possible enhancement would be surfacing a few additional pieces of metadata:

  1. Configured interval value
  2. Interval source (timedelta vs VariableInterval)
  3. Callback type (for example, SlackWebhookNotifier)

Users can always inspect the DAG definition for this information, but exposing it directly in the UI would make deadline investgation more self-service. For e.g., if critical SLA is missed and a DeadlineAlert fires, an operator or stakeholder could immediately understand what deadline was configured and what notification mechanism was invoked without needing to inspect the DAG code.

Add a callback-logs API endpoint and UI viewer so users can see the logs
produced during async (triggerer) and executor deadline callback execution,
matching the task-log UX. Includes the callback log reader, the
CallbackLogViewer component, and triggerer-side callback log capture/upload.
@seanghaeli seanghaeli force-pushed the ghaeli/callback-log-ui-visibility branch from ab9c123 to 299fe32 Compare June 15, 2026 17:55
@seanghaeli

Copy link
Copy Markdown
Contributor Author

Thanks @SameerMesiah97, that's good feedback. I'll leave it out of this PR so we're making less assumptions about what the user wants to see, but will keep this in mind for a follow-up

@SameerMesiah97

Copy link
Copy Markdown
Contributor

Thanks @SameerMesiah97, that's good feedback. I'll leave it out of this PR so we're making less assumptions about what the user wants to see, but will keep this in mind for a follow-up

Yes. Personally, it’s up to you (and the AWS team). Those were just my thoughts when I saw your dev list post.

@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jun 17, 2026
@vincbeck

Copy link
Copy Markdown
Contributor

Can you update the screenshots to reflect the last changes?

seanghaeli pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jun 17, 2026
Refreshed deadline_status.png (run-page Deadline section: Missed badge, Callback
Logs button, Expected/Actual) and callback_logs_modal.png (the structured
Callback Logs modal with the line-numbered log viewer + source details) to match
the latest UI on apache#66610. Per @vincbeck's request.
@seanghaeli

Copy link
Copy Markdown
Contributor Author

@vincbeck Screenshots in the PR description are up to date now

@guan404ming guan404ming left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks nice for ui wise. Just left some comments

Comment thread airflow-core/src/airflow/ui/src/pages/Run/CallbackLogViewer.tsx Outdated
Comment thread airflow-core/src/airflow/ui/src/pages/Run/CallbackLogViewer.tsx Outdated
Sean Ghaeli added 2 commits June 19, 2026 21:38
…anceState

Address review feedback on the deadline callback-log viewer:
- Replace the hand-rolled stateColorMap + Badge with the shared StateBadge
  component (maps state to colorPalette and adds the state icon), matching
  the usage in Run/Details.
- Type the callbackState prop as TaskInstanceState instead of a bare string;
  cast dl.callback_state at the two call sites since the generated API schema
  types it as string.
…ructuredLog)

The prettier import-sort is case-sensitive (uppercase before lowercase),
so StateBadge must precede renderStructuredLog. Fixes the ts-compile-lint-ui
static check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:logging ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants