Ensure the log messages from operators during parsing go somewhere#26779
Merged
ashb merged 5 commits intoapache:mainfrom Sep 30, 2022
Merged
Ensure the log messages from operators during parsing go somewhere#26779ashb merged 5 commits intoapache:mainfrom
ashb merged 5 commits intoapache:mainfrom
Conversation
2 tasks
Member
Author
|
We shouldn't merge this to a release until we also fix the source of the issue (which is a bug, not user error) |
While investigating apache#26599 and the change from AIP-45, I noticed that these warning messages weren't new! The only thing that was new was that we started seeing them. This is because the logger for BaseOperator and all subclasses is `airflow.task.operators`, and the `airflow.task` logger is not configured (with `set_context()`) until we have a TaskInstance, so it just dropped all messages on the floor! This changes it so that log messages are propagated to parent loggers by default, but when we configure a context (and thus have a file to write to) we stop that. A similar change was made for the `airflow.processor` (but that is unlikely to suffer the same fate)
e2d19c5 to
fba879e
Compare
jedcunningham
approved these changes
Sep 29, 2022
kaxil
reviewed
Sep 29, 2022
ashb
commented
Sep 29, 2022
The ArangoDB sensor test was logging a mock object, which previously was getting dropped before emitting, but with this change now fails with "Mock is not an integer" when attempting the `%d` intepolation. To avoid making the mock overly specific (`arangodb_client_for_test.db.` `return_value.aql.execute.return_value.count.return_value`!) I have changed the test to mock the hook entirely (which is already tested)
ephraimbuddy
pushed a commit
that referenced
this pull request
Oct 18, 2022
…26779) * Ensure the log messages from operators during parsing go somewhere While investigating #26599 and the change from AIP-45, I noticed that these warning messages weren't new! The only thing that was new was that we started seeing them. This is because the logger for BaseOperator and all subclasses is `airflow.task.operators`, and the `airflow.task` logger is not configured (with `set_context()`) until we have a TaskInstance, so it just dropped all messages on the floor! This changes it so that log messages are propagated to parent loggers by default, but when we configure a context (and thus have a file to write to) we stop that. A similar change was made for the `airflow.processor` (but that is unlikely to suffer the same fate) * Give a real row count value so logs don't fail The ArangoDB sensor test was logging a mock object, which previously was getting dropped before emitting, but with this change now fails with "Mock is not an integer" when attempting the `%d` interpolation. To avoid making the mock overly specific (`arangodb_client_for_test.db.` `return_value.aql.execute.return_value.count.return_value`!) I have changed the test to mock the hook entirely (which is already tested) (cherry picked from commit 7363e35)
37 tasks
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While investigating #26599 and the change from AIP-45, I noticed that these warning messages weren't new! The only thing that was new was that we started seeing them.
This is because the logger for BaseOperator and all subclasses is
airflow.task.operators, and theairflow.tasklogger is not configured (withset_context()) until we have a TaskInstance, so it just dropped all messages on the floor!This changes it so that log messages are propagated to parent loggers by default, but when we configure a context (and thus have a file to write to) we stop that. A similar change was made for the
airflow.processor(but that is unlikely to suffer the same fate)