This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch v2-2-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit ce341b6eeb2bb1827eb2e947179e628ff1e1648b Author: Josh Fell <[email protected]> AuthorDate: Tue Oct 12 10:02:01 2021 -0400 Updating explicit arg example in TaskFlow API tutorial doc (#18907) (cherry picked from commit b4321de8d17d8f167f2bb3f9ddb1e4ebeed0665e) --- docs/apache-airflow/tutorial_taskflow_api.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/apache-airflow/tutorial_taskflow_api.rst b/docs/apache-airflow/tutorial_taskflow_api.rst index 076f48b..e58f490 100644 --- a/docs/apache-airflow/tutorial_taskflow_api.rst +++ b/docs/apache-airflow/tutorial_taskflow_api.rst @@ -416,14 +416,16 @@ When running your callable, Airflow will pass a set of keyword arguments that ca 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. +the values of ``ti`` and ``next_ds`` context variables. Note that when explicit keyword arguments are used, +they must be made optional in the function header to avoid ``TypeError`` exceptions during DAG parsing as +these values are not available until task execution. With explicit arguments: .. code-block:: python @task - def my_python_callable(ti, next_ds): + def my_python_callable(ti=None, next_ds=None): pass With kwargs:
