Skip to content

Remote log handlers don't report whether an upload worked #76640

Open

Description

@seanghaeli

RemoteLogIO.upload() returns None (shared/logging/src/airflow_shared/logging/remote.py), and the handlers signal the result in different, implicit ways:

  • S3, GCS and WASB empty the local file when the upload works and leave it when it fails, only logging the error.
  • HDFS and OSS never empty the file, so a caller can't tell a stored file from a failed one.
  • OSS appends to the remote object, so uploading the same file twice stores its lines twice.

Anything that uploads a file more than once, or needs to know whether it can delete the local copy, has to guess from the file's contents. The triggerer's watcher log files (#76527) hit this: they can only retry a failed part for S3, GCS and WASB, and OSS already stores a released watcher's file twice.

Suggestion: have upload() return whether the file was stored (or raise on failure), and make OSS replace the object instead of appending, or skip content it already stored.

Activity

  1. Priyeshshrivastav commented on Nov 7, 2026

    @Priyeshshrivastav

    Hi @seanghaeli ,

    I came across your issue #76640 regarding remote log handlers not reporting upload success.

    I'd be interested in contributing to this issue. I have experience with Python and backend development, and I'd like to explore the RemoteLogIO.upload() behavior and help implement a consistent upload-success mechanism along with the necessary tests.

    Would you be open to me working on this? I'd be happy to start by investigating the existing implementations and proposing a solution before making changes.

    Thanks!

  2. schizophrenicmaniac commented on Nov 7, 2026

    @schizophrenicmaniac
    Contributor

    I'd like to work on this. I plan to make RemoteLogIO.upload() return whether the file was stored, update the S3/GCS/WASB/HDFS/OSS handlers to report it consistently, and switch OSSRemoteLogIO to overwrite the object instead of appending, with tests for each handler.

  3. seanghaeli commented on Nov 7, 2026

    @seanghaeli
    ContributorAuthor

    @Priyeshshrivastav Sure, give it a shot!

  4. seanghaeli commented on Nov 18, 2026

    @seanghaeli
    ContributorAuthor

    Once upload() reports the result, the triggerer's watcher log files (#76527) can use it in five places that guess today, in airflow/utils/log/watcher_log.py and airflow/jobs/triggerer_job_runner.py:

    • WatcherLogs.upload_rotated: a rotated file is sent again once (WatcherLogs._upload_rotated_again, same file) if its upload raised, except with OSS, or if S3, GCS, WASB or OSS left its lines.
    • WatcherLogs._upload_orphaned_trigger_log_dir: the same rule for the files a dead or stopped triggerer left behind; those it judges failed stay for the next triggerer that starts on that disk.
    • WatcherLogs.upload_rotated again: the next rotation deletes the previous file after its upload and one retry, whether or not it was stored.
    • WatcherLoggingFactory.upload_to_remote / WatcherLogs.upload_and_close: the upload when a watcher leaves the triggerer, or when the triggerer stops, isn't retried. A file it failed to store keeps its lines, so they go with that watcher's next upload if it comes back to this triggerer, or else to the next triggerer that starts on that disk.
    • upload_watcher_log_file: OSSRemoteLogIO.upload drops the result of oss_write, so for OSS it calls oss_write directly and empties the file only when the write succeeded. Once upload() reports success, replace that direct oss_write call with upload()'s result.

    These pick the store by handler class name (_EMPTIES_STORED_FILE_HANDLERS, _LINES_LEFT_MEAN_FAILED_HANDLERS and the lists next to them). That has to stay as the fallback for providers that don't return a result yet.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions