Skip to content

Commit 9f5a668

Browse files
authored
Merge pull request #87750 from v-thepet/cicd
Refresh ci-cd-flask.md
2 parents 98f8257 + 923e377 commit 9f5a668

File tree

2 files changed

+40
-42
lines changed

2 files changed

+40
-42
lines changed
Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,62 @@
11
---
2-
title: Create continuous integration Azure pipeline - Team Data Science Process
3-
description: "DevOps for Artificial Intelligence (AI) applications: Creating continuous integration pipeline on Azure using Docker and Kubernetes"
2+
title: Create a CI/CD pipeline with Azure Pipelines - Team Data Science Process
3+
description: "Create a continuous integration and continuous delivery pipeline for Artificial Intelligence (AI) applications using Docker and Kubernetes."
44
services: machine-learning
55
author: marktab
66
manager: cgronlun
77
editor: cgronlun
88
ms.service: machine-learning
99
ms.subservice: team-data-science-process
1010
ms.topic: article
11-
ms.date: 05/22/2018
11+
ms.date: 09/06/2019
1212
ms.author: tdsp
1313
ms.custom: seodec18, previous-author=jainr, previous-ms.author=jainr
1414
---
15-
# Creating continuous integration pipeline on Azure using Docker, Kubernetes, and Python Flask application
16-
For an AI application, there are frequently two streams of work, Data Scientists building machine learning models and App developers building the application and exposing it to end users to consume. In this article, we demonstrate how to implement a Continuous Integration (CI)/Continuous Delivery (CD) pipeline for an AI application. AI application is a combination of application code embedded with a pretrained machine learning (ML) model. For this article, we are fetching a pretrained model from a private Azure blob storage account, it could be an AWS S3 account as well. We will use a simple python flask web application for the article.
15+
# Create CI/CD pipelines for AI apps using Azure Pipelines, Docker, and Kubernetes
16+
17+
An Artificial Intelligence (AI) application is application code embedded with a pretrained machine learning (ML) model. There are always two streams of work for an AI application: Data scientists build the ML model, and app developers build the app and expose it to end users to consume. This article describes how to implement a continuous integration and continuous delivery (CI/CD) pipeline for an AI application that embeds the ML model into the app source code. The sample code and tutorial use a simple Python Flask web application, and fetch a pretrained model from a private Azure blob storage account. You could also use an AWS S3 storage account.
1718

1819
> [!NOTE]
19-
> This is one of several ways CI/CD can be performed. There are alternatives to the tooling and other pre-requisites mentioned below. As we develop additional content, we will publish those.
20-
>
21-
>
20+
> The following process is one of several ways to do CI/CD. There are alternatives to this tooling and the prerequisites.
21+
22+
## Source code, tutorial, and prerequisites
23+
24+
You can download [source code](https://github.com/Azure/DevOps-For-AI-Apps) and a [detailed tutorial](https://github.com/Azure/DevOps-For-AI-Apps/blob/master/Tutorial.md) from GitHub. Follow the tutorial steps to implement a CI/CD pipeline for your own application.
25+
26+
To use the downloaded source code and tutorial, you need the following prerequisites:
2227

23-
## GitHub repository with document and code
24-
You can download the source code from [GitHub](https://github.com/Azure/DevOps-For-AI-Apps). A [detailed tutorial](https://github.com/Azure/DevOps-For-AI-Apps/blob/master/Tutorial.md) is also available.
28+
- The [source code repository](https://github.com/Azure/DevOps-For-AI-Apps) forked to your GitHub account
29+
- An [Azure DevOps Organization](/azure/devops/organizations/accounts/create-organization-msa-or-work-student)
30+
- [Azure CLI](/cli/azure/install-azure-cli)
31+
- An [Azure Container Service for Kubernetes (AKS) cluster](/azure/container-service/kubernetes/container-service-tutorial-kubernetes-deploy-cluster)
32+
- [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) to run commands and fetch configuration from the AKS cluster
33+
- An [Azure Container Registry (ACR) account](/azure/container-registry/container-registry-get-started-portal)
2534

26-
## Pre-requisites
27-
The following are the pre-requisites for following the CI/CD pipeline described below:
28-
* [Azure DevOps Organization](https://docs.microsoft.com/azure/devops/organizations/accounts/create-organization-msa-or-work-student)
29-
* [Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest)
30-
* [Azure Container Service (AKS) cluster running Kubernetes](https://docs.microsoft.com/azure/container-service/kubernetes/container-service-tutorial-kubernetes-deploy-cluster)
31-
* [Azure Container Registry (ACR) account](https://docs.microsoft.com/azure/container-registry/container-registry-get-started-portal)
32-
* [Install Kubectl to run commands against Kubernetes cluster.](https://kubernetes.io/docs/tasks/tools/install-kubectl/) We will need this to fetch configuration from ACS cluster.
33-
* Fork the repository to your GitHub account.
35+
## CI/CD pipeline summary
3436

35-
## Description of the CI/CD pipeline
36-
The pipeline kicks off for each new commit, run the test suite, if the test passes takes the latest build, packages it in a Docker container. The container is then deployed using Azure Container Service (ACS) and images are securely stored in Azure Container Registry (ACR). ACS is running Kubernetes for managing container cluster but you can choose Docker Swarm or Mesos.
37+
Each new Git commit kicks off the Build pipeline. The build securely pulls the latest ML model from a blob storage account, and packages it with the app code in a single container. This decoupling of the application development and data science workstreams ensures that the production app is always running the latest code with the latest ML model. If the app passes testing, the pipeline securely stores the build image in a Docker container in ACR. The release pipeline then deploys the container using AKS.
3738

38-
The application securely pulls the latest model from an Azure Storage account and packages that as part of the application. The deployed application has the app code and ML model packaged as single container. This decouples the app developers and data scientists, to make sure that their production app is always running the latest code with latest ML model.
39+
## CI/CD pipeline steps
3940

40-
The pipeline architecture is given below.
41+
The following diagram and steps describe the CI/CD pipeline architecture:
4142

42-
![Architecture](./media/ci-cd-flask/Architecture.PNG?raw=true)
43+
![CI/CD pipeline architecture](./media/ci-cd-flask/architecture.png)
4344

44-
## Steps of the CI/CD pipeline
45-
1. Developer work on the IDE of their choice on the application code.
46-
2. They commit the code to source control of their choice (Azure DevOps has good support for various source controls)
47-
3. Separately, the data scientist work on developing their model.
48-
4. Once happy, they publish the model to a model repository, in this case we are using a blob storage account.
49-
5. A build is kicked off in Azure DevOps based on the commit in GitHub.
50-
6. Azure DevOps Build pipeline pulls the latest model from Blob container and creates a container.
51-
7. Azure DevOps pushes the image to private image repository in Azure Container Registry
52-
8. On a set schedule (nightly), release pipeline is kicked off.
53-
9. Latest image from ACR is pulled and deployed across Kubernetes cluster on ACS.
54-
10. Users request for the app goes through DNS server.
55-
11. DNS server passes the request to load balancer and sends the response back to user.
45+
1. Developers work on the application code in the IDE of their choice.
46+
2. The developers commit the code to Azure Repos, GitHub, or other Git source control provider.
47+
3. Separately, data scientists work on developing their ML model.
48+
4. The data scientists publish the finished model to a model repository, in this case a blob storage account.
49+
5. Azure Pipelines kicks off a build based on the Git commit.
50+
6. The Build pipeline pulls the latest ML model from blob storage and creates a container.
51+
7. The pipeline pushes the build image to the private image repository in ACR.
52+
8. The Release pipeline kicks off based on the successful build.
53+
9. The pipeline pulls the latest image from ACR and deploys it across the Kubernetes cluster on AKS.
54+
10. User requests for the app go through the DNS server.
55+
11. The DNS server passes the requests to a load balancer, and sends responses back to the users.
5656

57-
## Next steps
58-
* Refer to the [tutorial](https://github.com/Azure/DevOps-For-AI-Apps/blob/master/Tutorial.md) to follow the details and implement your own CI/CD pipeline for your application.
57+
## See also
5958

60-
## References
61-
* [Team Data Science Process (TDSP)](https://aka.ms/tdsp)
62-
* [Azure Machine Learning (AML)](https://docs.microsoft.com/azure/machine-learning/service/)
63-
* [Azure DevOps](https://www.visualstudio.com/vso/)
64-
* [Azure Kubernetes Services (AKS)](https://docs.microsoft.com/azure/aks/intro-kubernetes)
59+
- [Team Data Science Process (TDSP)](/azure/machine-learning/team-data-science-process/)
60+
- [Azure Machine Learning (AML)](/azure/machine-learning/)
61+
- [Azure DevOps](https://azure.microsoft.com/services/devops/)
62+
- [Azure Kubernetes Services (AKS)](/azure/aks/intro-kubernetes)
5.49 KB
Loading

0 commit comments

Comments
 (0)