"""
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

[((11, 6, 11, 33), 'logging.getLogger', 'logging.getLogger', ({(11, 24, 11, 32): '__name__'}, {}), '(__name__)', False, 'import logging\n'), ((20, 5, 20, 34), 'airflow.decorators.task', 'task', (), '', False, 'from airflow.decorators import task\n'), ((27, 5, 27, 32), 'airflow.decorators.task', 'task', (), '', False, 'from airflow.decorators import task\n'), ((30, 8, 30, 21), 'time.sleep', 'time.sleep', ({(30, 19, 30, 20): '(1)'}, {}), '(1)', False, 'import time\n'), ((16, 15, 16, 35), 'datetime.datetime', 'datetime', ({(16, 24, 16, 28): '(2021)', (16, 30, 16, 31): '(1)', (16, 33, 16, 34): '(1)'}, {}), '(2021, 1, 1)', False, 'from datetime import datetime\n')]