Skip to content

Commit

Permalink
feat(workshop): clean up for workshop (#26)
Browse files Browse the repository at this point in the history
* feat(workshop): clean up for workshop

* feat(workshop): clean up for workshop

* feat(workshop): clean up for workshop

* feat(workshop): clean up for workshop

* feat(workshop): clean up for workshop

* feat(workshop): clean up for workshop

* feat(workshop): clean up for workshop

* feat(workshop): clean up for workshop

* feat(workshop): clean up for workshop

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml
  • Loading branch information
guillaume-chervet authored Dec 17, 2023
1 parent 66e00cf commit eea9c48
Show file tree
Hide file tree
Showing 9 changed files with 240 additions and 83 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ env:
AZURE_LOCATION: "northeurope"
AZURE_ML_WORKSPACE_NAME: "cats-dogs-yola"
AZURE_WEBAPP_NAME: "cats-dogs-yola"
DELETE_WEBAPP: "true"
DOCKER_IMAGE_NAME: "guillaumechervet/mlopspython"
DELETE_WEBAPP: "false"
DOCKER_IMAGE_NAME: "guillaumechervetlunique/mlopspython"

permissions:
id-token: write
Expand Down Expand Up @@ -196,7 +196,10 @@ jobs:
poetry run python azureml_run_pipeline.py \
--subscription_id ${{ secrets.AZURE_SUBSCRIPTION_ID }} \
--resource_group_name ${{ env.AZURE_RESOURCE_GROUP_NAME }} \
--workspace_name ${{ env.AZURE_ML_WORKSPACE_NAME }} > train_output.txt
--workspace_name ${{ env.AZURE_ML_WORKSPACE_NAME }} \
--location ${{ env.AZURE_LOCATION }} \
--tags "{\"triggering_actor\":\"${{github.triggering_actor}}\"}" \
> train_output.txt
cat train_output.txt
working-directory: train
- name: download model
Expand Down Expand Up @@ -272,6 +275,7 @@ jobs:
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
deploy:
environment: MLOpsPython
runs-on: ubuntu-latest
needs: [tags, build_docker]
steps:
Expand All @@ -286,6 +290,7 @@ jobs:
# https://learn.microsoft.com/en-us/cli/azure/container?view=azure-cli-latest#az-container-create()
az container create --resource-group ${{ env.AZURE_RESOURCE_GROUP_NAME}} --name ${{ env.AZURE_WEBAPP_NAME }} --dns-name-label ${{ env.AZURE_WEBAPP_NAME }} --image docker.io/${{ env.DOCKER_IMAGE_NAME }}:${{ needs.tags.outputs.new_version }} --ports 5000
integration_tests:
environment: MLOpsPython
runs-on: ubuntu-latest
needs: [deploy, train]
steps:
Expand All @@ -312,7 +317,7 @@ jobs:
poetry install
az extension add -n ml
poetry run python azureml_run_pipeline.py \
--subscription_id ${{ env.AZURE_SUBSCRIPTION_ID }} \
--subscription_id ${{ secrets.AZURE_SUBSCRIPTION_ID }} \
--resource_group_name ${{ env.AZURE_RESOURCE_GROUP_NAME }} \
--workspace_name ${{ env.AZURE_ML_WORKSPACE_NAME }} \
--experiment_id ${{ needs.train.outputs.EXPERIMENT_ID }} \
Expand Down
10 changes: 5 additions & 5 deletions bin/init_repository.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ az login
gh auth login

# Fork MLOPsPython repository
gh repo fork https://github.com/guillaume-chervet/MLOpsPythonDemo1 --default-branch-only --fork-name $repositoryName --clone
gh repo fork https://github.com/guillaume-chervet/MLOpsPython --default-branch-only --fork-name $repositoryName --clone
cd $repositoryName
git remote remove upstream
git push --set-upstream origin main
Expand Down Expand Up @@ -63,9 +63,9 @@ gh secret set DOCKER_USENAME --body "dckr_pat_e2lZ9YgpMt8APE-Qxzn89u6mt28" --env

# Run workflow
gh workflow enable main.yml
gh workflow run main.yml
$runId=$(gh run list --workflow=main.yml --json databaseId -q ".[0].databaseId")
gh run watch $runId
#gh workflow run main.yml
#$runId=$(gh run list --workflow=main.yml --json databaseId -q ".[0].databaseId")
#gh run watch $runId

# Open the repostory in the browser
# Open the repository in the browser
gh repo view -w
6 changes: 3 additions & 3 deletions bin/init_repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ gh secret set DOCKER_USENAME --body "dckr_pat_e2lZ9YgpMt8APE-Qxzn89u6mt28" --env

# Run the GitHub workflow
gh workflow enable main.yml
gh workflow run main.yml
#gh workflow run main.yml

# Get the run ID
runId=$(gh run list --workflow=main.yml --json databaseId -q ".[0].databaseId")
#runId=$(gh run list --workflow=main.yml --json databaseId -q ".[0].databaseId")

# Watch the run
gh run watch "$runId"
#gh run watch "$runId"

# Open the repository in the browser
gh repo view -w
51 changes: 27 additions & 24 deletions documentation/workshop.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workshop Cloud Nord
# Workshop MLOps

Welcome aboard the MLOpsPython team !

Expand Down Expand Up @@ -34,9 +34,9 @@ You can also check health check route with HTTP GET:

http://cats-dogs-yolo.northeurope.azurecontainer.io:5000/health

## 2. Fork the project MLOpsPython
## 3. Initialize your own project

### 2.1. Create your Azure Account
### 3.1. Create your Azure Account

Important point:
- About azure coupon:
Expand All @@ -53,25 +53,28 @@ https://www.microsoftazurepass.com/?WT.mc_id=DOP-MVP-5003370
Documentation:
https://www.microsoftazurepass.com/Home/HowTo?WT.mc_id=DOP-MVP-5003370

### 2.3. Fork the GitHub project MLOpsPython

Prerequisite to install on your laptop:

1. Fork https://github.com/guillaume-chervet/MLOpsPython repository
2. Go to GitHub Action Tab and activate it !
3. Clone your new own **MLOpsPython** repository

Je vous mets à disposition les fichiers de script ci-dessous :
Copier un de ces deux fichiers disponibles ici https://github.com/guillaume-chervet/... chez vous et exécuter le Powershell (.ps1) si vous êtes sous Windows et le bash (.sh) si vous êtes sous linux ou mac.

Il se base sur ce super Article réalisé par Alexandre Nédélec que je remercie : https://www.techwatching.dev/posts/sc...

### 3.2. Fork the GitHub project MLOpsPython

**On Windows**:
1. Download https://github.com/guillaume-chervet/MLOpsPython/blob/main/bin/init_repository.ps1 PowerShell Script
2. Open a PowerShell Terminal then run
````ps
./init_repository.ps1
````
3. Go to GitHub Action Tab and activate it !

**On Linux or Mac**:
1. Download https://github.com/guillaume-chervet/MLOpsPython/blob/main/bin/init_repository.sh Bash Script
2. Open a Bash Terminal then run
````bach
chmod +x ./init_repository.sh
./init_repository.ps1
````


### 2.6. Adapt GitHub Action Parameters
### 3.3. Adapt GitHub Action Parameters

Inside "./.github/workflows/ci.yml" file
Inside "./.github/workflows/main.yml" file

````bash

Expand All @@ -83,7 +86,7 @@ env:

````

### 2.7. Run GitHub Action
### 3.4. Run GitHub Action

Commit and push your code

Expand All @@ -97,7 +100,7 @@ git push origin main

This will trigger the GitHub Action.

## 3. Getting Started on your laptop
## 4. Getting Started on your laptop

Follow "Get Started" section to run the project on your laptop :

Expand All @@ -107,7 +110,7 @@ https://github.com/your-github-login/MLOpsPython
- Drift dataset: https://github.com/guillaume-chervet/dataset-cats-dogs-others-drift
- You can test with your own files :)

## 4. First Contribution : Images Labelling
## 5. First Contribution : Images Labelling

We need you to annotate 200 images of classification of :
- cat
Expand All @@ -123,7 +126,7 @@ https://axaguildev-ecotag.azurewebsites.net/projects/2329f843-fa3d-45df-bec5-08d
For you culture, Ecotag is an awesome Open Source tool available here :
https://github.com/AxaGuilDEv/ecotag

## 5. Second Contribution : CleanCode & PullRequest
## 6. Second Contribution : CleanCode & PullRequest

Our team Kanban:

Expand All @@ -146,7 +149,7 @@ git commit -m "refactor(myfonctionnality): commit message"
git push
```

## 6. How to check your API result
## 7. How to check your API result

1. Follow "ml-cli" readme and download "ml-cli" version v0.54.2 for your OS https://github.com/AxaFrance/ecotag/blob/master/README-ML-CLI.md
2. Download https://github.com/guillaume-chervet/dataset-cats-dogs-others-mlcli as a zip and unzip content in "demo" folder
Expand All @@ -172,7 +175,7 @@ try {
```


## 7. More AzureML
## 8. More AzureML

1. Create a AzureML Compute Instance
2. Open JupyterLab with Python 3.10 and SDK v2
Expand Down
Loading

0 comments on commit eea9c48

Please sign in to comment.