Airflow Integration
Apache Airflow is an open source platform ETL platform to manage company’s complex workflows. Companies are increasingly integrating their ML models pipeline into Airflow DAGs to manage and monitor all the components of their ML model system.
By integrating Fiddler into an existing Airflow DAG, you will be able to train, manage, and onboard your models while actively monitoring performance, data quality, and troubleshooting degradations across your models.
Fiddler can be easily integrated into your existing airflow DAG for ML model pipeline. A notebook which is used for publishing events can be orchestrated to run as a part of your airflow DAG using a ‘Papermill Operator’.
Steps for the walkthrough
Setup airflow on your local or docker, these steps can be followed. Link
Add your jupyter notebook containing the code for publishing to your airflow home directory. In this example we will use the 2 different notebooks -
Add an orchestration code to your airflow directory, airflow will pick up the orchestration code and construct a DAG as defined. The orchestration code contains the ‘papermill operator’ to orchestrate the jupyter notebooks which will be used to onboard models and publish events to Fiddler. Please refer to our orchestration code.
The run interval can be set up in orchestration code as ‘schedule_interval’ in the DAG class. This interval can be based on the frequency of training and inference of your ML model.
Once the DAGs are set up it can be monitored on the UI. Below we can see dummy DAGs have been set up with placeholder nodes for ‘data preparation ETL’ and ‘model training/inference’. We have two DAGs -
a. To set up Fiddler model registration after preparing baseline data (training pipeline)
b. To publish events to Fiddler after data preparation and ML model inference (inference pipeline)
Label Update
An important business use case is integrating Fiddler’s ‘Label Update’ as a part of your ML workflow using Airflow. Label update can be used to update the ground truth feature in your data. This can be done using the ‘publish_event’ api, passing the event, event_id parameters, and making the update_event parameter as ‘True’. The code to update label can be found in the notebook This notebook can be integrated to run as a part of your airflow DAG using the sample code
Papermill Operator
Airflow DAG
Below is an example of Model Registration Airflow DAG run history
![](https://docs.fiddler.ai/~gitbook/image?url=https%3A%2F%2F2341805124-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FNEyFKGwv2eAllsWbuafo%252Fuploads%252Fgit-blob-443dd1199e7e39c3435b92ce43110bf384b31d8f%252F3fb8a21-model_registration_1.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=48a9ebf6&sv=1)
Model Registration Airflow DAG flow
![](https://docs.fiddler.ai/~gitbook/image?url=https%3A%2F%2F2341805124-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FNEyFKGwv2eAllsWbuafo%252Fuploads%252Fgit-blob-0613c5d853757915dc3272f42929bbb1372e5f73%252F2891852-model_registration_2.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=d343848c&sv=1)
Last updated