This is an automated email from the ASF dual-hosted git repository. kaxilnaik pushed a commit to branch v1-10-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 92a1040ce152118997fe75231acc4069e3668b48 Author: Jonny Fuller <mr.waff...@gmail.com> AuthorDate: Sat May 9 20:33:45 2020 -0400 Fix docs on creating CustomOperator (#8678) (cherry picked from commit 5e1c33a1baf0725eeb695a96b29ddd9585df51e4) --- docs/howto/custom-operator.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/howto/custom-operator.rst b/docs/howto/custom-operator.rst index 7713468..a9733d2 100644 --- a/docs/howto/custom-operator.rst +++ b/docs/howto/custom-operator.rst @@ -148,7 +148,7 @@ the operator. self.name = name def execute(self, context): - message = "Hello from {}".format(name) + message = "Hello from {}".format(self.name) print(message) return message @@ -157,9 +157,9 @@ You can use the template as follows: .. code:: python with dag: - hello_task = HelloOperator(task_id='task_id_1', dag=dag, name='{{ task_id }}') + hello_task = HelloOperator(task_id='task_id_1', dag=dag, name='{{ task_instance.task_id }}') -In this example, Jinja looks for the ``name`` parameter and substitutes ``{{ task_id }}`` with +In this example, Jinja looks for the ``name`` parameter and substitutes ``{{ task_instance.task_id }}`` with ``task_id_1``.