45 lines
976 B
Python
45 lines
976 B
Python
from datetime import datetime
|
|
from airflow import DAG
|
|
from airflow.operators.bash import BashOperator
|
|
from airflow.operators.python import PythonOperator
|
|
|
|
|
|
# RUN it if aiflow wokrs or not.
|
|
|
|
def print_statement():
|
|
print("Hello from the Python function!!!!!")
|
|
|
|
def print_message():
|
|
print("Last message from Python!, hope things are going good")
|
|
|
|
with DAG(
|
|
'demo_task_workflow',
|
|
start_date=datetime(2025, 6, 13),
|
|
schedule_interval=None,
|
|
catchup=False,
|
|
) as dag:
|
|
|
|
task1 = BashOperator(
|
|
task_id='print_with_bash',
|
|
bash_command='echo "Lets begin"',
|
|
)
|
|
|
|
task2 = PythonOperator(
|
|
task_id='print_with_python',
|
|
python_callable=print_statement,
|
|
)
|
|
|
|
task3 = BashOperator(
|
|
task_id='another_bash_task',
|
|
bash_command='echo "So far so good!"',
|
|
)
|
|
|
|
task4 = PythonOperator(
|
|
task_id='another_python_task',
|
|
python_callable=print_message,
|
|
)
|
|
|
|
|
|
task1 >> task2 >> task3 >> task4
|
|
|