From the course: Apache Airflow Essential Training

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

DAG using PythonOperators

DAG using PythonOperators

- [Instructor] In this demo, we'll see how you can work with the TaskFlow API in Apache Airflow. The TaskFlow API is new in version 2.0 of Apache Airflow and it makes it simpler for you to write your DAGs using Python code rather than operators, so you eliminate a lot of boilerplate that's associated with operators. Now, before we look at the TaskFlow API, let's take a look at a very simple Python DAG that uses operators and then, we'll switch this DAG over to use the TaskFlow API. I already have the code set up here. Observe the import on line eight, importing the PythonOperator. This is what we'll use to invoke python_callables in our code. I've set up the default arguments for my DAG. I have owner set to loonycorn and then, I've defined a bunch of very simple tasks where each task is a Python function. I have five different Python tasks here, task A through task E, and each of these tasks simply prints out a…

Contents