MulaiMulai sekarang secara gratis

More PythonOperators

To continue implementing your workflow, you need to add another step to parse and save the changes of the downloaded file. The DAG process_sales_dag is defined and has the pull_file task already added. In this case, the Python function is already defined for you, parse_file(inputfile, outputfile).

Note that often when implementing Airflow tasks, you won't necessarily understand the individual steps given to you. As long as you understand how to wrap the steps within Airflow's structure, you'll be able to implement a desired workflow.

Latihan ini adalah bagian dari kursus

Introduction to Apache Airflow in Python

Lihat Kursus

Petunjuk latihan

  • Define the Python task to the variable parse_file_task with the id parse_file.
  • Add the parse_file(inputfile, outputfile) to the Operator.
  • Define the arguments to pass to the callable.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Add another Python task
____ = ____(
    task_id=____,
    # Set the function to call
    ____
    # Add the arguments
    ____={'inputfile':'latestsales.json', 'outputfile':'parsedfile.json'},
)
    
Edit dan Jalankan Kode