Skip to content
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

Ensure "airflow.task" logger used for TaskInstancePydantic and TaskInstance #37857

Merged
merged 1 commit into from
Mar 3, 2024

Conversation

dstandish
Copy link
Contributor

@dstandish dstandish commented Mar 3, 2024

Airflow TIs are assumed to log to the "airflow.task" logger. TaskInstance was configuring this in the "reconstructor", a sqlalchemy thing that is processed on loading from DB. But there's no equivalent for Pydantic models, and when running a task with TaskInstancePydantic, the wrong logger was used (fully qualified class name). When looking for a solution, I saw that LoggingMixin will check _logger_name and if set will use it. This works for the pydantic model and seems better for TI anyway so I updated both.

…skInstance

Airflow TIs are assumed to log to the "airflow.task" logger.  TaskInstance was configuring this in the "reconstructor", a sqlalchemy thing that is processed on loading from DB.  But there's no equivalent for Pydantic models, and when running a task with TaskInstancePydantic, the wrong logger was used (fully qualified class name).  When looking for a solution, I saw that LoggingMixin will check `_logger_name` and if set will use it.  This works for the pydantic model and seems better for TI anyway so I updated both.
@dstandish dstandish changed the title Ensure the "airflow.task" logger used for TaskInstancePydantic and Ta… Ensure the "airflow.task" logger used for TaskInstancePydantic and TaskInstance Mar 3, 2024
@dstandish dstandish changed the title Ensure the "airflow.task" logger used for TaskInstancePydantic and TaskInstance Ensure "airflow.task" logger used for TaskInstancePydantic and TaskInstance Mar 3, 2024
@dstandish dstandish requested review from potiuk and mhenc March 3, 2024 05:17
@potiuk potiuk merged commit ede1912 into apache:main Mar 3, 2024
60 checks passed
abhishekbhakat pushed a commit to abhishekbhakat/my_airflow that referenced this pull request Mar 5, 2024
…skInstance (apache#37857)

Airflow TIs are assumed to log to the "airflow.task" logger.  TaskInstance was configuring this in the "reconstructor", a sqlalchemy thing that is processed on loading from DB.  But there's no equivalent for Pydantic models, and when running a task with TaskInstancePydantic, the wrong logger was used (fully qualified class name).  When looking for a solution, I saw that LoggingMixin will check `_logger_name` and if set will use it.  This works for the pydantic model and seems better for TI anyway so I updated both.
@utkarsharma2 utkarsharma2 added type:improvement Changelog: Improvements type:bug-fix Changelog: Bug Fixes labels Mar 6, 2024
utkarsharma2 pushed a commit to astronomer/airflow that referenced this pull request Apr 22, 2024
…skInstance (apache#37857)

Airflow TIs are assumed to log to the "airflow.task" logger.  TaskInstance was configuring this in the "reconstructor", a sqlalchemy thing that is processed on loading from DB.  But there's no equivalent for Pydantic models, and when running a task with TaskInstancePydantic, the wrong logger was used (fully qualified class name).  When looking for a solution, I saw that LoggingMixin will check `_logger_name` and if set will use it.  This works for the pydantic model and seems better for TI anyway so I updated both.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:serialization type:bug-fix Changelog: Bug Fixes type:improvement Changelog: Improvements
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants