Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions airflow-core/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,21 @@ Let's look at a code snippet that defines a simple Dag:
from airflow.providers.standard.operators.bash import BashOperator

# A Dag represents a workflow, a collection of tasks
with DAG(dag_id="demo", start_date=datetime(2022, 1, 1), schedule="0 0 * * *") as dag:
# Tasks are represented as operators
with DAG(dag_id="demo", start_date=datetime(2022, 1, 1), schedule="0 0 * * *"):
# Tasks are defined by instantiating operators
hello = BashOperator(task_id="hello", bash_command="echo hello")

@task()
# Equivalent of BashOperator using the Airflow Taskflow syntax
@task.bash
def airflow():
print("airflow")
return "echo airflow"

@task
def world():
print("world")

# Set dependencies between tasks
hello >> airflow()
hello >> airflow() >> world()


Here you see:
Expand Down