Skip to content

Commit

Permalink
Docs: Fix Taskflow API docs (apache#16574)
Browse files Browse the repository at this point in the history
Add missing `def` statement and `EmailOperator` import.
  • Loading branch information
WhiteHotLoveTiger committed Jun 22, 2021
1 parent 2a59de3 commit b7f1257
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/apache-airflow/concepts/taskflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ If you write most of your DAGs using plain Python code rather than Operators, th
TaskFlow takes care of moving inputs and outputs between your Tasks using XComs for you, as well as automatically calculating dependencies - when you call a TaskFlow function in your DAG file, rather than executing it, you will get an object representing the XCom for the result (an ``XComArg``), that you can then use as inputs to downstream tasks or operators. For example::

from airflow.decorators import task
from airflow.operators.email import EmailOperator

@task
def get_ip():
return my_ip_service.get_main_ip()

@task
compose_email(external_ip):
def compose_email(external_ip):
return {
'subject':f'Server connected from {external_ip}',
'body': f'Your server executing Airflow is connected from the external IP {external_ip}<br>'
Expand Down

0 comments on commit b7f1257

Please sign in to comment.