Skip to content

Commit

Permalink
adding release-deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
guipleite committed Mar 31, 2021
1 parent e302767 commit 02caef6
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/deploy_on_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: model-deploy-on-release
on:
release:
types: # This configuration does not affect the page_build event above
- created
runs-on: [ubuntu-latest]
container: docker://dvcorg/cml-py3:latest
steps:
- uses: actions/checkout@v2
- name: 'Train and Evaluate model'
shell: bash
env:
repo_token: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CRED_SECRET: ${{ secrets.IBM_CREDENTIALS_PASS }}
run: |
# Install requirements
pip install -r requirements.txt
# Pull data & run-cache from S3 and reproduce pipeline
dvc pull --run-cache
dvc repro
# Decrypt credentials file
gpg --quiet --batch --yes --decrypt --passphrase="$CRED_SECRET" --output credentials.yaml credentials.yaml.gpg
# Check if there is a deployment already, if positive update it, otherwise deploys it for the first time
./src/scripts/Scripts/git_release_pipeline.sh
Binary file added credentials.yaml.gpg
Binary file not shown.
4 changes: 2 additions & 2 deletions metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
author: guipleite
datetime_creted: 29/03/2021_13:46:23:802394723
deployment_uid: 59562979-4bb8-4cc4-85f0-fb7a280b8b3c
deployment_uid: 9e70e6bf-49d9-418c-8c7a-cf7c876e9fc9
model_type: scikit-learn_0.23
model_uid: 3d5e76dc-a4a3-43a9-ab54-debbdbdc8673
model_uid: 12439c9c-4999-463d-8c66-57e4927caf70
project_name: Rain_aus
project_version: v0.3
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ seaborn
matplotlib
joblib
numpy
ibm_watson_machine_learning
24 changes: 24 additions & 0 deletions src/scripts/Pipelines/git_release_pipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os
import sys
import yaml

"""
Usage:
python3 model_deploy_pipeline.py ./pickle_model ../path/to/project/ ../credentials.yaml
"""

PROJ_PATH = os.path.abspath(sys.argv[1])
META_PATH = PROJ_PATH + "/metadata.yaml"

with open(META_PATH) as stream:
try:
metadata = yaml.safe_load(stream)
except yaml.YAMLError as exc:
print(exc)

if "deployment_uid" in metadata.keys():
sys.exit(1)

else:
sys.exit(0)
10 changes: 10 additions & 0 deletions src/scripts/Scripts/git_release_pipeline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

if python3 ./src/scripts/Pipelines/git_release_pipeline.py ./
then
echo " Model already has been deployed, updating it"
python3 ./src/scripts/Pipelines/model_update_pipeline.py ./models/model.joblib ./ ./credentials.yaml
else
echo " Deploying model for the first time"
python3 ./src/scripts/Pipelines/model_deploy_pipeline.py ./models/model.joblib ./ ./credentials.yaml
fi

2 comments on commit 02caef6

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics

Path Metric Old New Change

Plots

ROC Curve

Precision and Recall Curve

CML watermark

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics

Path Metric Old New Change

Plots

ROC Curve

Precision and Recall Curve

CML watermark

Please sign in to comment.