Integrating ML and DevOps

Arifiya Khan
4 min readMay 26, 2020

I learned Machine learning and DevOps,and implemented my skills on doing this task given by our Vimal Daga sir.

so the task is as follows:-

1. Create container image that’s has Python3 and Keras or numpy installed using dockerfile

2. When we launch this image, it should automatically starts train the model in the container.

3. Create a job chain of job1, job2, job3, and job4 using build pipeline plugin in Jenkins

4. Job1 : Pull the Github repo automatically when some developers push repo to Github.

5. Job2 : By looking at the code or program file, Jenkins should automatically start the respective machine learning software installed interpreter install image container to deploy code and start training the model and predict accuracy or metrics.

6. Job3 : if metrics accuracy is less than 80% , then tweak the machine learning model architecture.

7.Job4: If the accuracy is more than 80% then send the mail to the developer.

For this integration we need to have a machine learning model.

Tools Used:-

Git,jenkins,docker,Github

In this I have made a machine learning model which i pushed into GitHub with the help of git bash.

After this I made Images in docker using DOckerfile.Here I made Two images:-

First image
second image

After creating images in dockerfile,build the images using command

docker build -t ari123:v2 .

where ari123:v2 was my image name

Now lauching os on my image

Also for tunneling, add webhook in Github.For this the command used in docker is

./ngrok http 8080

Now let’s start building the jobs

Job1

The job of job 1 is to fetch the files from the github.

Here I have given the link of repository of github from where jenkins will download the files

Job2

In job2,By looking at the code or program file, Jenkins should automatically start the respective machine learning software installed interpreter install image container to deploy code and start training the model and predict accuracy or metrics.

Job3

if metrics accuracy is less than 80% , then tweak the machine learning model architecture.For this i made a file tweaking.py

Job4

This is my last job which will check the accuracy,if its satisfies with the condition then mail will be sent to the developer else developer have to retrain the model.

For sending mail,

After the mail sent,we can see all the jobs running successfully.so we can build a pipeline using build pipeline

Pipeline view

--

--