This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 01f904b866a documentation - first example more explicit on airflow
syntax (#71316)
01f904b866a is described below
commit 01f904b866a00ef5c86a52e641e0eeae26c33a9c
Author: raphaelauv <[email protected]>
AuthorDate: Wed Sep 9 14:15:46 2026 +0200
documentation - first example more explicit on airflow syntax (#71316)
* documentation - more explicit comment on airflow syntax
* review 1
Co-authored-by: Christos Bisias <[email protected]>
---------
Co-authored-by: raphaelauv <[email protected]>
Co-authored-by: Christos Bisias <[email protected]>
---
airflow-core/docs/index.rst | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/airflow-core/docs/index.rst b/airflow-core/docs/index.rst
index 879ccb50e08..8ce90348c72 100644
--- a/airflow-core/docs/index.rst
+++ b/airflow-core/docs/index.rst
@@ -60,22 +60,28 @@ 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 can be defined by instantiating operators
hello = BashOperator(task_id="hello", bash_command="echo hello")
- @task()
+ # Tasks can be also defined with decorators (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:
- A Dag named ``"demo"``, scheduled to run daily starting on January 1st,
2022. A Dag is how Airflow represents a workflow.
-- Two tasks: One using a ``BashOperator`` to run a shell script, and another
using the ``@task`` decorator to define a Python function.
+- Two Bash tasks: to run a shell script, one using a ``BashOperator`` and
another using the ``@task.bash`` decorator.
+- One Python task: to run a Python function using the ``@task`` decorator.
- The ``>>`` operator defines a dependency between the two tasks and controls
execution order.
Airflow parses the script, schedules the tasks, and executes them in the
defined order. The status of the ``"demo"`` Dag