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.

Tasks with multiple outputs

Tasks with multiple outputs

- [Instructor] In this demo, we'll understand some of the nuances of passing data between tasks using the task flow API. Now I've defined a dag that is very similar to the one that we've used in the previous demo but I've simplified it somewhat. As before, I have a function on line 19 passing data with the task flow API that is annotated using the at dag decorator. Now, within that I have specified a number of tasks. The first task is get order prices annotated using at task and that returns the order price data on line 31. Now instead of having two separate tasks, one to compute the average price and another to compute the total price, I've collapsed all of the code into a single task, compute total and average, again decorated with the at task annotation. Compute total and average takes in the order price data which is the dictionary return by get order prices. Now, within that we run a for loop compute the total and…

Contents