Skip to content

Add remote log upload support for callback subprocesses#66379

Open
seanghaeli wants to merge 2 commits intoapache:mainfrom
aws-mwaa:ghaeli/callback-remote-logging
Open

Add remote log upload support for callback subprocesses#66379
seanghaeli wants to merge 2 commits intoapache:mainfrom
aws-mwaa:ghaeli/callback-remote-logging

Conversation

@seanghaeli
Copy link
Copy Markdown
Contributor

@seanghaeli seanghaeli commented May 4, 2026

Summary

Enable callback logs (deadline alerts, SLA notifications, etc.) to be uploaded to remote storage (S3, GCS, etc.) so they are visible in the Airflow UI when remote logging is configured.

Key change: make ti optional in RemoteLogIO.upload() protocol and upload_to_remote() since callbacks don't have a task instance. The 7 providers that ignore ti (S3, GCS, CloudWatch, WASB, OSS, HDFS, Alibaba) work immediately. Elasticsearch and OpenSearch now handle the ti=None case gracefully (log a warning and skip upload since they need TI for log ID rendering).

Changes

  • Make ti optional (RuntimeTI | None = None) in RemoteLogIO.upload() protocol and upload_to_remote()
  • Update Elasticsearch and OpenSearch provider upload() signatures to match protocol
  • Add _upload_logs() to CallbackSubprocess.wait(), delegating to upload_to_remote with error handling
  • Wire up _remote_logging_conn(client) in _configure_logging() so remote log handler processors are initialized
  • Add unit tests for callback log upload behavior

Related

Enable callback logs (deadline alerts, SLA notifications, etc.) to be
uploaded to remote storage (S3, GCS, etc.) so they are visible in the
Airflow UI when remote logging is configured.

Key change: make `ti` optional in `RemoteLogIO.upload()` protocol and
`upload_to_remote()` since callbacks don't have a task instance. The 7
providers that ignore `ti` (S3, GCS, CloudWatch, WASB, OSS, HDFS,
Alibaba) work immediately. Elasticsearch and OpenSearch use `ti` for
log ID rendering and will need a follow-up to handle the `ti=None`
case — until then, callback log upload failures for those providers
are caught and logged without affecting callback execution.

- Make `ti` optional (`RuntimeTI | None = None`) in
  `RemoteLogIO.upload()` protocol and `upload_to_remote()`
- Add `_upload_logs()` to `CallbackSubprocess.wait()`, delegating to
  `upload_to_remote` with error handling that swallows failures
- Wire up `_remote_logging_conn(client)` in `_configure_logging()` so
  remote log handler processors are initialized during logging setup
- Move logging setup inside `_ensure_client()` context in
  `supervise_callback()` so the client is available for
  `_configure_logging()`
…gging path

Update Elasticsearch and OpenSearch provider upload() signatures to match
the RemoteLogIO protocol (ti: RuntimeTI | None = None). Both providers now
handle ti=None gracefully by logging a warning and returning early, since
they require task instance metadata for log ID rendering.

Also adds a test for the "remote logging not configured" code path in
CallbackSubprocess._upload_logs().
@seanghaeli seanghaeli marked this pull request as ready for review May 7, 2026 01:02
@seanghaeli
Copy link
Copy Markdown
Contributor Author

@ferruzzi @ramitkataria your reviews would be much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant