Variables not quite right
Your boss asks you to look into an issue where a sales report is not being generated. You've recently implemented variables in one of your Dags (process_sales) which processes some assorted sales data and writes out the report your boss is asking about. While looking at the logs, you realize that it's not writing to the intended location, but a default one.
The task that processes the report does the following:
@task()
def parse_file():
output_path = Variable.get("Output_Path", default="/home")
output_fn = Variable.get("Output_Filename", default="sales_report.pdf")
save_file("{output_path}/{output_fn}")
The file should be stored as /data/sales/sales_report.pdf.
Try running the command airflow dags test process_sales to view the log output.
Which of the following is the reason for the error, and how would you fix it?
This exercise is part of the course
Introduction to Apache Airflow in Python
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
Start Exercise