How to render an Airflow template for testing

This article is a part of my "100 data engineering tutorials in 100 days" challenge. (30/100)

Do you know what I do when I have to test a failing Airflow task? I copy the rendered template and run the code on my own, without Airflow. It is way easier to fiddle with the parameters, for example, to get more verbose output.

To get a rendered template, I used to open an instance of the task, copy the code, and change the parameters to match the execution date I wanted. That is the long and error-prone way to do it.

It turns out that the Airflow command-line interface has a command that generates a rendered template of a given task for the execution date we choose. No more copy-pasting and looking for parameters to change!

All we need is this command:

1
airflow render dag_id task_id execution_date



Remember to share on social media!
If you like this text, please share it on Facebook/Twitter/LinkedIn/Reddit or other social media.

If you want to contact me, send me a message on LinkedIn or Twitter.

Would you like to have a call and talk? Please schedule a meeting using this link.


Bartosz Mikulski
Bartosz Mikulski * data/machine learning engineer * conference speaker * co-founder of Software Craft Poznan & Poznan Scala User Group


This website DOES NOT use cookies
but you may still see the cookies set earlier if you have already visited it.