"""
A simple Python DAG using the Taskflow API.
"""
import logging
import time
from datetime import datetime

from airflow import DAG
from airflow.decorators import task

log = logging.getLogger(__name__)

with DAG(
    dag_id='simple_python_taskflow_api',
    schedule_interval=None,
    start_date=datetime(2021, 1, 1),
    catchup=False,
    tags=['airflow101'],
) as dag:
    @task(task_id="hello_message")
    def say_hello():
        """Print a hello message"""
        print("Hello, World!")

    hello_task = say_hello()

    @task(task_id="go_to_sleep")
    def sleep_for_1():
        """Go to sleep"""
        time.sleep(1)

    sleeping_task = sleep_for_1()

    hello_task >> sleeping_task

[((177, 204), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (194, 204), False, 'import logging\n'), ((381, 410), 'airflow.decorators.task', 'task', ([], {'task_id': '"""hello_message"""'}), "(task_id='hello_message')\n", (385, 410), False, 'from airflow.decorators import task\n'), ((535, 562), 'airflow.decorators.task', 'task', ([], {'task_id': '"""go_to_sleep"""'}), "(task_id='go_to_sleep')\n", (539, 562), False, 'from airflow.decorators import task\n'), ((620, 633), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (630, 633), False, 'import time\n'), ((300, 320), 'datetime.datetime', 'datetime', (['(2021)', '(1)', '(1)'], {}), '(2021, 1, 1)\n', (308, 320), False, 'from datetime import datetime\n')]