uranusjr commented on code in PR #59922:
URL: https://github.com/apache/airflow/pull/59922#discussion_r2660272678


##########
airflow-core/newsfragments/59835.significant.rst:
##########
@@ -1,5 +1,6 @@
 Methods removed from TaskInstance
 
-On class ``TaskInstance``, functions ``run()``, ``render_templates()``, and
-private members related to them have been removed. The class has been
-considered internal since 3.0, and should not be relied on in user code.
+On class ``TaskInstance``, functions ``run()``, ``render_templates()``,
+``get_template_context()``, and private members related to them have been
+removed. The class has been considered internal since 3.0, and should not be
+relied on in user code.

Review Comment:
   The context is passed to a task’s `execute()`, which is the entry point to 
run a task, and any function marked by `next_method` when deferred, so you 
should just get it directly. If you lose track of the context object at any 
point during a task’s execution, there’s also 
`airflow.sdk.get_current_context()` to retrieve it.
   
   The only use case you’d want `get_template_context()` (I can think of) is to 
somehow run a task outside Airflow’s management. I’d say it’s better to 
refactor so you can just call the relevant logic without calling the operator 
instead. But maybe there are some other use cases.



-- 
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]

Reply via email to