From 24e579764aace38592792b0d2ef4f21238584f5a Mon Sep 17 00:00:00 2001 From: ronilpatil Date: Sun, 5 May 2024 18:11:37 +0530 Subject: [PATCH] bug fixes & improvement in cicd --- .github/workflows/cicd.yaml | 15 ++++++++------- prod/mlflowdb.py | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index c33d50c..272580e 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -31,23 +31,23 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 - - name: Install AWS CLI + - name: Install AWS CLI # install aws cli in runner space run: | sudo apt-get update sudo apt-get install -y awscli - - name: Configure AWS CLI + - name: Configure AWS CLI # configure aws cli so that we can access there services via cmd line or scripts run: | aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws configure set region ${{ secrets.AWS_REGION }} - - name: Install Utilities + - name: Install Utilities # install utilities required to fetch model from backend run: | python -m pip install --upgrade pip if [ -f model_requirements.txt ]; then pip install -r model_requirements.txt; fi - - name: Fetch Model From Mlflow + - name: Fetch Model From Mlflow # below script will executed and fetch the prod model run: | python ./prod/mlflowdb.py ${{ secrets.TRACKING_URI }} @@ -82,12 +82,13 @@ jobs: - name: Print Current Directory af-down # for debugging run: ls /home/runner/work/cicd/cicd - - name: Build Docker Image + - name: Build Docker Image run: | docker build -t ${{ secrets.DOCKER_USERNAME }}/wineqcicd:v1.1 . - - name: Log-in to Docker Hub + - name: Log-in to Docker Hub run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} - - name: Push Docker Img + - name: Push Docker Img # push the previously built img to dockerhub run: docker push ${{ secrets.DOCKER_USERNAME }}/wineqcicd:v1.1 + \ No newline at end of file diff --git a/prod/mlflowdb.py b/prod/mlflowdb.py index 3503643..35d267a 100644 --- a/prod/mlflowdb.py +++ b/prod/mlflowdb.py @@ -6,7 +6,7 @@ from mlflow.sklearn import load_model def get_model(tracking_uri) : - # Define your machine learning model class + # Define your machine learning model class mlflow.set_tracking_uri(tracking_uri) # tracking_uri = params['mlflow_config']['mlflow_tracking_uri'] client = MlflowClient() @@ -23,7 +23,7 @@ def save_model(uri) -> None: model, details = get_model(uri) joblib.dump(model, './model.joblib') - with open('model_details.json', 'w') as jsn : + with open('./model_details.json', 'w') as jsn : json.dump({'name': details.name, 'version': details.version, 'alias': details.aliases,