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.

Passing multiple outputs in TaskFlow

Passing multiple outputs in TaskFlow - Apache Airflow Tutorial

From the course: Apache Airflow Essential Training

Passing multiple outputs in TaskFlow

- [Instructor] Here I am back in my code. And let me show you how you can fix tasks that send multiple outputs, such that the individual outputs can be accessed outside of the task. I'm going to update the decorator that I applied to this compute total and average function. So that the @task decorator specifies a parameter. The @task decorator supports many configuration parameters, such as the task id, that's one. But it also supports multiple outputs that is a Boolean parameter. Setting multiple outputs to true indicates to Airflow that this task produces multiple outputs, that should be accessible outside of the task. Now what I return here on line 45 remains the same. I only return the dictionary. Now here I still have the same code as before. Observe how I invoke display result. I access price summary data and look up the values corresponding to the keys "total_price" and "average_price." This is what was not…

Contents