Skip to content

Instantly share code, notes, and snippets.

@kplr-io
Last active May 29, 2023 12:28
Show Gist options
  • Save kplr-io/fe026e4ff2a3bde5c1bd8cc2362760b1 to your computer and use it in GitHub Desktop.
Save kplr-io/fe026e4ff2a3bde5c1bd8cc2362760b1 to your computer and use it in GitHub Desktop.
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