Last active
May 29, 2023 12:28
-
-
Save kplr-io/fe026e4ff2a3bde5c1bd8cc2362760b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow import DAG | |
from airflow.operators.python_operator import PythonOperator | |
from datetime import datetime, timedelta | |
def hello_world(): | |
print("#############################################") | |
print(" Hello, AIRFLOW!") | |
print((datetime.now()+timedelta(hours=2)).strftime("%y-%m-%d %H:%M:%S")) | |
print("#############################################") | |
# Define the DAG | |
dag = DAG( | |
'hello_world_dag', | |
description='A simple DAG that prints Hello, World!', | |
start_date=datetime(2023, 5, 1), | |
schedule_interval='@once' | |
) | |
# Define the task | |
hello_task = PythonOperator( | |
task_id='hello_task', | |
python_callable=hello_world, | |
dag=dag | |
) | |
# Set the task dependencies | |
hello_task | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment