From 458604f52987356fdbd76c84fa8e6dd4a4fc6fd6 Mon Sep 17 00:00:00 2001 From: Jonny Fuller Date: Sat, 9 May 2020 20:33:45 -0400 Subject: [PATCH] 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 7713468bd49b85..a9733d2afff26d 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``.