Skip to content

Fix broken import in TaskHandlerWithCustomFormatter#66357

Open
jfmlima wants to merge 1 commit into
apache:mainfrom
jfmlima:fix/task-handler-render-template-import
Open

Fix broken import in TaskHandlerWithCustomFormatter#66357
jfmlima wants to merge 1 commit into
apache:mainfrom
jfmlima:fix/task-handler-render-template-import

Conversation

@jfmlima
Copy link
Copy Markdown

@jfmlima jfmlima commented May 4, 2026

TaskHandlerWithCustomFormatter fails to import on Airflow 3.2.x because it references the private function _render_template_to_string from airflow.utils.helpers, which was removed in #54715.

This causes an ImportError at startup for any deployment using a custom logging config that references this handler:

from airflow.utils.helpers import _render_template_to_string, parse_template_string
ImportError: cannot import name '_render_template_to_string' from 'airflow.utils.helpers'

Uses the public render_template_to_string from airflow.sdk.definitions.context (where #54715 moved it) instead of the removed private function.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Anthropic)

Generated-by: Claude Code following the guidelines


@boring-cyborg
Copy link
Copy Markdown

boring-cyborg Bot commented May 4, 2026

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 Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@jfmlima jfmlima force-pushed the fix/task-handler-render-template-import branch 2 times, most recently from d6d21b5 to 98ac485 Compare May 5, 2026 20:55
`_render_template_to_string` was removed from `airflow.utils.helpers`
in apache#54715 but this module was not updated, causing an ImportError at
startup when using a custom logging config that references this handler.

Use the public `render_template_to_string` from
`airflow.sdk.definitions.context` instead.
@jfmlima jfmlima force-pushed the fix/task-handler-render-template-import branch from 98ac485 to be14dd6 Compare May 11, 2026 20:59
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:logging ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants