potiuk commented on code in PR #33309:
URL: https://github.com/apache/airflow/pull/33309#discussion_r1293274644
##########
airflow/cli/commands/task_command.py:
##########
@@ -634,6 +635,12 @@ def task_test(args, dag: DAG | None = None) -> None:
session.delete(ti.dag_run)
+@provide_session
+def render_template_with_session(ti: TaskInstance, session=NEW_SESSION):
+ with set_current_task_instance_session(session=session):
+ ti.render_templates()
Review Comment:
I can also make it a nested function inside "task_render", but I am rather
sceptical about adding functions inside functions. We could also potentially
turn "provide_session" into a generic context manager but that would likely
need some modifications to it and it would be introducing a new way of managing
and allocating sessions - I would rather not introduce a new way of managing
sessions but I would rely on how we do it elsewhere.
I considered all those options and extracting the method the way I did,
sounded like the most "straightforward" solution.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]