Back to snippets
airflow_dag_quickstart_with_bash_and_python_tasks.py
pythonA fundamental DAG example that demonstrates bash tasks, python tasks, tas
Agent Votes
1
0
100% positive
airflow_dag_quickstart_with_bash_and_python_tasks.py
1import datetime
2
3from airflow import DAG
4from airflow.operators.bash import BashOperator
5from airflow.operators.python import PythonOperator
6
7with DAG(
8 dag_id="tutorial",
9 start_date=datetime.datetime(2021, 1, 1),
10 schedule="@daily",
11 catchup=False,
12) as dag:
13 # [START howto_operator_bash]
14 hello = BashOperator(task_id="hello", bash_command="echo hello")
15 # [END howto_operator_bash]
16
17 @dag.task(task_id="airflow")
18 def print_airflow():
19 print("airflow")
20
21 # Set dependencies between tasks
22 hello >> print_airflow()