-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup Docker operator logging #33914
Cleanup Docker operator logging #33914
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
|
Does this PR aim to solve #33692 ? |
I think #33692 is unrelated to the issue that I'm trying to solve here. This PR is about the logging output from Docker containers which is printed multiple times to the Airflow logs, whereas #33692 is about an issue that Python 3.11 prints exceptions differently, which messes up the logs in Airflow. |
I just noticed that there are some unit tests that check if the raised Exception of the Docker operator contains the container logs. Before I'm adapting / removing those checks: Is there actually a reason why we want to have the container logs attached to the raised exception? I mean the logs of the Docker container are displayed anyways in Airflow (even before the exception is raised). |
Including logs in the exception message was added in #14761 (confusingly in a pull request that otherwise has nothing to do with the Docker operator) here: 5661273#diff-5ec82e1fcaaa38e04471f56b64ec319f67b146d3a18d8bdb69c2f973ea3dd585 But the behaviour was not explicitly tested until much later, in another seemingly unrelated pull request #21175. So I think there’s really no particular reason to maintain the behaviour if it is problematic. It is probably still a good idea to keep the log somewhere (for example, raise a custom exception that has a |
Co-authored-by: Tzu-ping Chung <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @eladkal on moving the exceptions to a separate module. Otherwise, LGTM
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
We are using the DockerOperator and noticed that the logs are a bit confusing when there is an error in a Docker container (return code != 0) because Airflow shows the log output of the Docker container 3 times.
The logs of a failed run with the DockerOperator currently look like this:
This PR removes the output of the Docker container from the Airflow exception that is thrown. With this change the log output of the Docker container is only shown one single time in Airflow (regardless of the return code).
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in newsfragments.