LoslegenKostenlos starten

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?

Diese Übung ist Teil des Kurses

<Kurs>Einführung in Apache Airflow mit Python</Kurs>
Kurs ansehen

Interaktive praktische Übung

Verwandle Theorie mit einer unserer interaktiven Übungen in die Praxis

Übung starten