Reader small image

You're reading from  Engineering MLOps

Product typeBook
Published inApr 2021
PublisherPackt
ISBN-139781800562882
Edition1st Edition
Right arrow
Author (1)
Emmanuel Raj
Emmanuel Raj
author image
Emmanuel Raj

Emmanuel Raj is a Finland-based Senior Machine Learning Engineer with 6+ years of industry experience. He is also a Machine Learning Engineer at TietoEvry and a Member of the European AI Alliance at the European Commission. He is passionate about democratizing AI and bringing research and academia to industry. He holds a Master of Engineering degree in Big Data Analytics from Arcada University of Applied Sciences. He has a keen interest in R&D in technologies such as Edge AI, Blockchain, NLP, MLOps and Robotics. He believes "the best way to learn is to teach", he is passionate about sharing and learning new technologies with others.
Read more about Emmanuel Raj

Right arrow

Chapter 7: Building Robust CI/CD Pipelines

In this chapter, you will learn about continuous operations in the MLOps pipeline. The principles you will learn in this chapter are key to driving continuous deployments in a business context. To get a comprehensive understanding and first-hand experience, we will go through the concepts and hands-on implementation simultaneously. We will set up a CI/CD pipeline for the test environment while learning about components of continuous integration (CI) and continuous deployment (CD), pipeline testing, and releases and types of triggers. This will equip you with the skills to automate the deployment pipelines of machine learning (ML) models for any given scenario on the cloud with continual learning abilities in tune with business. Let's start by looking at why we need CI/CD in MLOps after all. We will continue by exploring the other topics as follows:

  • Continuous integration, delivery, and deployment in MLOps
  • Setting up a CI/CD...

Continuous integration, delivery, and deployment in MLOps

Automation is the primary reason for CI/CD in the MLOps workflow. The goal of enabling continuous delivery to the ML service is to maintain data and source code versions of the models, enable triggers to perform necessary jobs in parallel, build artifacts, and release deployments for production. Several cloud vendors are promoting DevOps services to monitor ML services and models in production, as well as orchestrate with other services on the cloud. Using CI and CD, we can enable continual learning, which is critical for a ML system's success. Without continual learning, a ML system is deemed to end up as a failed Proof of Concept (PoC).

Only a model deployed with continual learning capabilities can bring business value.

In order to learn to deploy a model in production with continual learning capabilities, we will explore CI, CD, and continuous delivery methods.

As you can see in Figure 7.1, CI is key to CD...

Setting up a CI/CD pipeline and the test environment (using Azure DevOps)

In the previous section, we went through the theory of CI, continuous delivery, and continuous deployment, and now it is time to see it in practice. Using Azure DevOps, we will set up a simple CI/CD pipeline of our own for the business problem (weather prediction), which we have been working on previously (in Chapter 6, Key Principles for Deploying Your ML System, in the Hands-on deployment section (for the business problem)).

Azure DevOps is a service provided by Microsoft that facilitates source code management (version control), project management, CI, continuous delivery, and continuous deployment (automated builds, testing, and release capabilities). It also enables life cycle management for software applications. We will use Azure DevOps for hands-on training as it comes with seamless integration with the Azure ML service, which we have been using previously in Chapter 6. You will experience the integration...

Pipeline execution and testing

Now, it is time to test your pipeline and for that we will create a release and validate whether the pipeline release has executed successfully. The following steps will help you to test your pipeline:

  1. Click on the Create release button to execute jobs configured on your pipeline. A popup will appear on the right of your screen (as shown in Figure 7.16) to view and select artifacts to deploy in your staging environment.
  2. Select the artifacts (_scaler and _support-vector-classifier) and select their versions. For simplicity, version 1 is recommended for both.

    If you want to choose another version of your model or scaler make sure to change the path of your model and scaler in the score.py file (that is, insert the appropriate version number in the scaler and model paths model-scaler/{version number}/modelscaler.pkl and support-vector-classifier/ {version number} /svc.onnx. If you choose version 1, you don't have to worry about changing...

Pipeline execution triggers

In an effective CI/CD pipeline, process execution should be possible by means of multiple events or triggers. Having the option to trigger the pipeline by only regular events, such as code repository or push-or-pull requests, might be a handicap or limitation for the system. Having the option to trigger the pipeline process using multiple events enhances the flexibility and functionality of the CI/CD pipeline. Let's look at some types of triggers that can add value to the CI/CD pipeline process:

  • Artifactory triggers

    Artifacts are generated at different stages in the pipeline and development process. Generated artifacts, such as a trained model, metadata, uploaded Docker images, or any file that has been uploaded, can be triggered to execute a certain process in the CI/CD pipeline. Having such options can enable great flexibility and functionality for the CI/CD pipeline.

  • Docker Hub triggers

    Every time you push a new Docker image to a Docker...

Summary

In this chapter, we have learned the key principles of continuous operations in MLOps, primarily, continuous integration, delivery, and deployment. We have learned this by performing a hands-on implementation of setting up a CI/CD pipeline and test environment using Azure DevOps. We have tested the pipeline for execution robustness and finally looked into some triggers to enhance the functionality of the pipeline and also set up a Git trigger for the test environment. This chapter serves as the foundation for continual operations in MLOps and equips you with the skills to automate the deployment pipelines of ML models for any given scenario on the cloud, with continual learning abilities in tune with your business.

In the next chapter, we will look into APIs, microservices, and what they have to offer for MLOps-based solutions.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Engineering MLOps
Published in: Apr 2021Publisher: PacktISBN-13: 9781800562882
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Emmanuel Raj

Emmanuel Raj is a Finland-based Senior Machine Learning Engineer with 6+ years of industry experience. He is also a Machine Learning Engineer at TietoEvry and a Member of the European AI Alliance at the European Commission. He is passionate about democratizing AI and bringing research and academia to industry. He holds a Master of Engineering degree in Big Data Analytics from Arcada University of Applied Sciences. He has a keen interest in R&D in technologies such as Edge AI, Blockchain, NLP, MLOps and Robotics. He believes "the best way to learn is to teach", he is passionate about sharing and learning new technologies with others.
Read more about Emmanuel Raj