Using lists with templates
Once again, you decide to make some modifications to the design of your cleandata
workflow. This time, you realize that you need to run the command cleandata.sh
with the date argument and the file argument as before, except now you have a list of 30 files. You do not want to create 30 tasks, so your job is to modify the code to support running the argument for 30 or more files.
The Python list of files is already created for you, simply called filelist
.
This exercise is part of the course
Introduction to Apache Airflow in Python
Exercise instructions
- Modify the
templated_command
to iterate over a list of filenames. - Pass the
filelist
to the templated command in the operator.
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
