yiga2 commented on a change in pull request #18868:
URL: https://github.com/apache/airflow/pull/18868#discussion_r761180475



##########
File path: docs/apache-airflow/tutorial_taskflow_api.rst
##########
@@ -286,6 +286,48 @@ In the above code block, a 
:class:`~airflow.providers.http.operators.http.Simple
 was captured via :doc:`XCOMs </concepts/xcoms>`. This XCOM result, which is 
the task output, was then passed
 to a TaskFlow decorated task which parses the response as JSON - and the rest 
continues as expected.
 
+Accessing context variables in decorated tasks
+----------------------------------------------
+
+When running your callable, Airflow will pass a set of keyword arguments that 
can be used in your
+function. This set of kwargs correspond exactly to what you can use in your 
jinja templates.
+For this to work, you need to define ``**kwargs`` in your function header, or 
you can add directly the
+keyword arguments you would like to get - for example with the below code your 
callable will get
+the values of ``ti`` and ``next_ds`` context variables.
+
+With explicit arguments:
+
+.. code-block:: python
+
+   @task
+   def my_python_callable(ti, next_ds):

Review comment:
       can `user-defined-macros` (i.e. defined at dag-level) be passed too ?? 
If so, would be good to mention in the doc too.




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