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 - Apache Airflow Tutorial
From the course: Apache Airflow Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Prerequisites39s
-
(Locked)
Quick Airflow setup overview3m 27s
-
(Locked)
DAG using PythonOperators3m 33s
-
(Locked)
DAG using TaskFlow3m 55s
-
(Locked)
Passing data using XCom with operators5m 37s
-
(Locked)
Passing data using the TaskFlow API4m 41s
-
(Locked)
Tasks with multiple outputs5m 40s
-
(Locked)
Passing multiple outputs in TaskFlow1m 47s
-
-
-
-
-
-