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

Session is not used in _do_render_template_fields #37856

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions airflow/models/abstractoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from airflow.utils.context import Context
from airflow.utils.db import exists_query
from airflow.utils.log.secrets_masker import redact
from airflow.utils.session import NEW_SESSION, provide_session
from airflow.utils.setup_teardown import SetupTeardownContext
from airflow.utils.sqlalchemy import with_row_locks
from airflow.utils.state import State, TaskInstanceState
Expand Down Expand Up @@ -659,16 +658,13 @@ def get_template_env(self, dag: DAG | None = None) -> jinja2.Environment:
dag = self.get_dag()
return super().get_template_env(dag=dag)

@provide_session
def _do_render_template_fields(
self,
parent: Any,
template_fields: Iterable[str],
context: Context,
jinja_env: jinja2.Environment,
seen_oids: set[int],
*,
session: Session = NEW_SESSION,
) -> None:
"""Override the base to use custom error logging."""
for attr_name in template_fields:
Expand Down
1 change: 0 additions & 1 deletion airflow/models/mappedoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,5 +752,4 @@ def render_template_fields(
context=context,
jinja_env=jinja_env,
seen_oids=seen_oids,
session=session,
)
5 changes: 0 additions & 5 deletions airflow/template/templater.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@
from airflow.utils.helpers import render_template_as_native, render_template_to_string
from airflow.utils.log.logging_mixin import LoggingMixin
from airflow.utils.mixins import ResolveMixin
from airflow.utils.session import NEW_SESSION, provide_session

if TYPE_CHECKING:
import jinja2
from sqlalchemy.orm import Session

from airflow import DAG
from airflow.models.operator import Operator
Expand Down Expand Up @@ -103,16 +101,13 @@ def resolve_template_files(self) -> None:
self.log.exception("Failed to get source %s", item)
self.prepare_template()

@provide_session
def _do_render_template_fields(
self,
parent: Any,
template_fields: Iterable[str],
context: Context,
jinja_env: jinja2.Environment,
seen_oids: set[int],
*,
session: Session = NEW_SESSION,
) -> None:
for attr_name in template_fields:
value = getattr(parent, attr_name)
Expand Down