-
Notifications
You must be signed in to change notification settings - Fork 159
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
Annoying duplicate celery logging in Airflow task logs when running in celery worker #639
Comments
Hi @agreenburg, duplicate logs are indeed annoying. Giving some context as to why they are duplicated:
How could we improve this? If we can't find a way to better use the Airflow logging system, we could look into exposing an Airflow config that could be used by Cosmos to disable log propagation, for instance. |
Thanks for the context @tatiana that's helpful. It seems like adding a parameter when constructing the Dag might be a simple approach so that we can override the default behavior. Something like this maybe? adding
|
I wonder if this should be set with an environment variable / Airflow config too? Just thinking that if you have this issue in one of your DAGs, you'll likely have them in all of your DAGs within the same environment. I think it's still worth being able to override the env var / config with an explicit parameter, so maybe a precedence order like so:
What do you think @agreenburg @tatiana? |
@jlaneve I agree - I wonder if it wouldn't be simpler just to do (2) and (3)! @agreenburg The challenge with the approach you suggested is that we'd have to make this parameter available wherever we're instantiating the logger handler, which can get a bit messy. We could introduce the Airflow config:
This would require. a change only on the logger module itself (and Cosmos docs):
|
Agreed that the Airflow config approach would be the simplest. I can't think of a use case where someone would want different behavior in different Dags. |
We could implement the Airflow config/default value - that would satisfy the (2) and (3) scenarios described by @jlaneve - and, in future - if necessary to control per DAG - we can implement (1). @agreenburg would you be interested in making this contribution? |
@tatiana sure thing. I will put together a submission. |
It looks like in order to register default airflow configurations for cosmos we would need to set this package up as a provider, which it currently is not. Are you comfortable with me adding a |
…opagation if desired (#648) Add Airflow config check for cosmos/propagate_logs to allow override of default propagation behavior. Expose entry-point so that Airflow can theoretically detect configuration default. Closes #639 ## Breaking Change? This is backward-compatible as it falls back to default behavior if the `cosmos` section or `propagate_logs` option don't exist. ## Checklist - [X] I have made corresponding changes to the documentation (if required) - [X] I have added tests that prove my fix is effective or that my feature works --------- Co-authored-by: Andrew Greenburg <[email protected]>
…opagation if desired (#648) Add Airflow config check for cosmos/propagate_logs to allow override of default propagation behavior. Expose entry-point so that Airflow can theoretically detect configuration default. Closes #639 ## Breaking Change? This is backward-compatible as it falls back to default behavior if the `cosmos` section or `propagate_logs` option don't exist. ## Checklist - [X] I have made corresponding changes to the documentation (if required) - [X] I have added tests that prove my fix is effective or that my feature works --------- Co-authored-by: Andrew Greenburg <[email protected]>
…opagation if desired (astronomer#648) Add Airflow config check for cosmos/propagate_logs to allow override of default propagation behavior. Expose entry-point so that Airflow can theoretically detect configuration default. Closes astronomer#639 ## Breaking Change? This is backward-compatible as it falls back to default behavior if the `cosmos` section or `propagate_logs` option don't exist. ## Checklist - [X] I have made corresponding changes to the documentation (if required) - [X] I have added tests that prove my fix is effective or that my feature works --------- Co-authored-by: Andrew Greenburg <[email protected]>
As of astronomer-cosmos version 1.2.1:
When running tasks in a managed Astronomer cluster (using Celery workers), each log message from the astronomer-cosmos custom logger is being re-logged as a warning level message by the Celery logger. This is very annoying and makes the logs difficult to read:
I think this may be because of the way that stdout/stderr are redirected by Celery. Is it possible to make the custom logging implementation more compatible with Airflow's built-in logging/Celery?
The text was updated successfully, but these errors were encountered: