Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
b0af5a6
configuration update
anildwarepo Feb 16, 2023
8e42a79
a short summary of changes made - update alpha value
anildwarepo Feb 16, 2023
dc0102f
update cd workflow
anildwarepo Feb 16, 2023
83fd454
fix mlops permission
anildwamsft Feb 16, 2023
726d5b0
configurations update
anildwamsft Aug 29, 2023
a2a7ee0
add self-hosted runner
anildwamsft Aug 29, 2023
dacc1eb
add self-hosted runner
anildwamsft Aug 29, 2023
c10ee9d
add self-hosted runner
anildwamsft Aug 29, 2023
7ec8405
add self-hosted runner
anildwamsft Aug 29, 2023
da8bae4
update ci yaml
anildwamsft Aug 30, 2023
cee69ea
update ci yaml
anildwamsft Aug 30, 2023
de03134
update cicd
anildwamsft Aug 30, 2023
290efa4
update conflicts
anildwamsft Aug 30, 2023
7c6fc9c
update
anildwamsft Aug 31, 2023
47e225b
update alpha
anildwamsft Aug 31, 2023
f2abc8f
update
anildwamsft Aug 31, 2023
7c4291c
update
anildwamsft Aug 31, 2023
13fd60f
update
anildwamsft Aug 31, 2023
e5b2b6b
fix shell script
anildwamsft Aug 31, 2023
bb8fb51
fix shell script
anildwamsft Aug 31, 2023
13d5443
update managed ep
anildwamsft Aug 31, 2023
2ac2703
update managed ep
anildwamsft Aug 31, 2023
f7951e4
update managed ep
anildwamsft Aug 31, 2023
7ea3367
update managed ep
anildwamsft Aug 31, 2023
03b7cb7
update managed ep
anildwamsft Aug 31, 2023
6b10cb4
new test
anildwarepo Aug 15, 2024
cfc35b6
enable public network access
anildwarepo Aug 16, 2024
2c3bdd7
Ridge alpha changed to 100
anildwarepo Aug 16, 2024
076c6b0
change github runners
anildwarepo Aug 16, 2024
a430e90
update aml ws name
anildwarepo Aug 16, 2024
15c287a
changed Ridge Alpha 1000
anildwarepo Aug 16, 2024
3f2d1e3
blue deployment
anildwarepo Aug 16, 2024
ca44269
blue deployment- pilot deployment
anildwarepo Aug 16, 2024
5d384c1
blue deployment- pilot deployment
anildwarepo Aug 16, 2024
5595042
pilot deploymentv1.0
anildwarepo Aug 16, 2024
ffad3d3
pilot deployment v1.1
anildwarepo Aug 16, 2024
5d58e20
pilot deployment v1.2
anildwarepo Aug 16, 2024
4533c0c
pilot deployment v1.3
anildwarepo Aug 16, 2024
aee49d8
pilot deployment v1.4
anildwarepo Aug 16, 2024
bddaec6
pilot deployment v1.5
anildwarepo Aug 16, 2024
f34b275
pilot deployment v1.5
anildwarepo Aug 16, 2024
9e4a9bb
pilot deployment v1.5
anildwarepo Aug 16, 2024
9231896
pilot deployment v1.7
anildwarepo Aug 16, 2024
0bc99e1
changed alpha to 100
anildwamsft Sep 13, 2024
aeba830
changed alpha to 1000
anildwamsft Sep 13, 2024
004ed26
changed alpha to 100
anildwamsft Sep 13, 2024
0ffcac4
reverted alpha to 1000
anildwamsft Sep 13, 2024
b1c3148
test changes here
anildwamsft Sep 13, 2024
1d2fbc2
update action/status to v4
anildwamsft Sep 13, 2024
6bc1374
happy path changes
anildwamsft Sep 13, 2024
9470114
changed alpha to 100
anildwamsft Sep 13, 2024
8fabb03
changed alpha to 1000
anildwamsft Sep 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .amlignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## This file was auto generated by the Azure Machine Learning Studio. Please do not remove.
## Read more about the .amlignore file here: https://docs.microsoft.com/azure/machine-learning/how-to-save-write-experiment-files#storage-limits-of-experiment-snapshots

.ipynb_aml_checkpoints/
*.amltmp
*.amltemp
6 changes: 6 additions & 0 deletions .amlignore.amltmp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## This file was auto generated by the Azure Machine Learning Studio. Please do not remove.
## Read more about the .amlignore file here: https://docs.microsoft.com/azure/machine-learning/how-to-save-write-experiment-files#storage-limits-of-experiment-snapshots

.ipynb_aml_checkpoints/
*.amltmp
*.amltemp
261 changes: 136 additions & 125 deletions .github/actions/aml-endpoint-deploy/action.yaml
Original file line number Diff line number Diff line change
@@ -1,126 +1,137 @@
name: Deploy AzureML managed online endpoint
description: 'Deploys a model endpoint in Azure Machine Learning Services all along with all the deployments it contains. Logs are collected and uploaded.'

inputs:
resourceGroup:
description: 'Name of the resource group where the workspace is placed.'
required: true
workspaceName:
description: 'Name of the workspace to work against.'
required: true
endpointFile:
description: 'Path to the endpoint YAML file.'
required: true
deploymentFile:
description: 'Path to the deployment YAML file for the given endpoint.'
required: true
modelVersion:
description: 'Model version you want to deploy. Supports either a specific version number, or "latest". If not specified, using the deployment file model version.'
required: false
default: ''
updateIfExists:
description: 'If endpoint exists, update it instead of creating a new one.'
required: false
default: 'false'
outputs:
deployedVersion:
description: 'Deployed version of the model'
value: ${{ steps.deployment.outputs.deployedVersion }}

runs:
using: "composite"
steps:
- name: Deploy endpoint
id: deployment
shell: bash
run: |
set -e
az configure --defaults workspace=${{ inputs.workspaceName }} group=${{ inputs.resourceGroup }}

ENDPOINT_FILE=${{ inputs.endpointFile }}
DEPLOYMENT_FILE=${{ inputs.deploymentFile }}

ENDPOINT_NAME=$(yq -r ".name" $ENDPOINT_FILE)
echo "Endpoint name: $ENDPOINT_NAME"

# Removing traffic if present in endpoint config as we'll manage traffic setup as part of the safe rollout
echo "Rewriting endpoint file without traffic"
yq -y -i "del(.traffic)" $ENDPOINT_FILE

# Create or update endpoint
{
echo "Creating endpoint with name: $ENDPOINT_NAME" &&
az ml online-endpoint create -f $ENDPOINT_FILE
} || {
echo "Endpoint $ENDPOINT_NAME already exists"
if [ ${{ inputs.updateIfExists }} == 'true' ]; then
echo "Updating endpoint with name: $ENDPOINT_NAME" &&
az ml online-endpoint update -f $ENDPOINT_FILE
else
echo "Skipping update of endpoint with name: $ENDPOINT_NAME"
fi
}

# Identify which slot should be used to stage this deployment based on current traffic
echo "Reading endpoint traffic to identify target staging deployment slot"
az ml online-endpoint show -n $ENDPOINT_NAME --query "traffic" -o yaml > _endpoint_traffic.yml
echo "Endpoint traffic:"
cat _endpoint_traffic.yml
GREEN_TRAFFIC=$(yq .green _endpoint_traffic.yml)
BLUE_TRAFFIC=$(yq .blue _endpoint_traffic.yml)
if [[ $GREEN_TRAFFIC == null || $GREEN_TRAFFIC == 0 ]]; then
STAGING_DEPLOYMENT_NAME='green';
else
if [[ $BLUE_TRAFFIC == null || $BLUE_TRAFFIC == 0 ]]; then
STAGING_DEPLOYMENT_NAME='blue';
else
echo "::error::No staging slots available for endpoint $ENDPOINT_NAME. One of the green/blue slots needs to have 0% traffic.";
exit 1;
fi
fi
echo "Selected staging deployment name: $STAGING_DEPLOYMENT_NAME"

# Updating deployment file to setup name of deployment based on staging name selected above
echo "Updating deployment name to $STAGING_DEPLOYMENT_NAME"
if [[ $STAGING_DEPLOYMENT_NAME == "blue" ]]; then
yq -y -i '.name= "blue"' $DEPLOYMENT_FILE;
else
yq -y -i '.name= "green"' $DEPLOYMENT_FILE;
fi

# Overwrite the model version set in the deployment file with a specific version or 'latest' if specified in the workflow
DEPLOYMENT_MODEL=$(yq -r ".model" $DEPLOYMENT_FILE | cut -d: -f2)
DEPLOYMENT_MODEL_VERSION=$(yq -r ".model" $DEPLOYMENT_FILE | cut -d: -f3)
if [ -z "${{ inputs.modelVersion}}" ]; then
TARGET_MODEL_VERSION=$DEPLOYMENT_MODEL_VERSION
else
echo "Model being targeted is being overwriten with version ${{ inputs.modelVersion}}"
TARGET_MODEL_VERSION=${{ inputs.modelVersion}}
fi
if [[ "$TARGET_MODEL_VERSION" == "latest" ]]; then
echo "Identifying latest version of the model $DEPLOYMENT_MODEL"
TARGET_MODEL_VERSION=$(az ml model list --name $DEPLOYMENT_MODEL | jq -r '.[0].version')
echo "Latest version of model $DEPLOYMENT_MODEL is $TARGET_MODEL_VERSION"
fi
if [[ $TARGET_MODEL_VERSION != $DEPLOYMENT_MODEL_VERSION ]]; then
echo "Updating deployment file with model version: $TARGET_MODEL_VERSION"
sed -i 's/:'$DEPLOYMENT_MODEL_VERSION'/:'$TARGET_MODEL_VERSION'/' $DEPLOYMENT_FILE
fi
echo "::set-output name=deployedVersion::$TARGET_MODEL_VERSION"

# Create deployment
echo "Creating deployment with name: $ENDPOINT_NAME/$STAGING_DEPLOYMENT_NAME"
az ml online-deployment create -f $DEPLOYMENT_FILE --only-show-errors --set tags.git_commit=${GITHUB_SHA}
echo "Deployment completed"

# Saving logs
echo "Acquiring logs for deployment with name: $ENDPOINT_NAME/$STAGING_DEPLOYMENT_NAME"
mkdir -p logs
az ml online-deployment get-logs --name $STAGING_DEPLOYMENT_NAME --endpoint-name $ENDPOINT_NAME >> logs/$ENDPOINT_NAME_$STAGING_DEPLOYMENT_NAME.log

- name: Upload deployment logs
uses: actions/upload-artifact@v2
if: ${{ (failure() || success()) }}
with:
name: deployment-logs
name: Deploy AzureML managed online endpoint
description: 'Deploys a model endpoint in Azure Machine Learning Services all along with all the deployments it contains. Logs are collected and uploaded.'

inputs:
resourceGroup:
description: 'Name of the resource group where the workspace is placed.'
required: true
workspaceName:
description: 'Name of the workspace to work against.'
required: true
endpointFile:
description: 'Path to the endpoint YAML file.'
required: true
deploymentFile:
description: 'Path to the deployment YAML file for the given endpoint.'
required: true
modelVersion:
description: 'Model version you want to deploy. Supports either a specific version number, or "latest". If not specified, using the deployment file model version.'
required: false
default: ''
updateIfExists:
description: 'If endpoint exists, update it instead of creating a new one.'
required: false
default: 'false'
outputs:
deployedVersion:
description: 'Deployed version of the model'
value: ${{ steps.deployment.outputs.deployedVersion }}

runs:
using: "composite"
steps:
- name: Deploy endpoint
id: deployment
shell: bash
run: |
set -e
az configure --defaults workspace=${{ inputs.workspaceName }} group=${{ inputs.resourceGroup }}

ENDPOINT_FILE=${{ inputs.endpointFile }}
DEPLOYMENT_FILE=${{ inputs.deploymentFile }}

ENDPOINT_NAME=$(yq -r ".name" $ENDPOINT_FILE)
echo "Endpoint name: $ENDPOINT_NAME"

# Removing traffic if present in endpoint config as we'll manage traffic setup as part of the safe rollout
echo "Rewriting endpoint file without traffic"
yq -y -i "del(.traffic)" $ENDPOINT_FILE

# Create or update endpoint
{
echo "Creating endpoint with name: $ENDPOINT_NAME" &&
az ml online-endpoint create -f $ENDPOINT_FILE
} || {
echo "Endpoint $ENDPOINT_NAME already exists"
if [ ${{ inputs.updateIfExists }} == 'true' ]; then
echo "Updating endpoint with name: $ENDPOINT_NAME" &&
az ml online-endpoint update -f $ENDPOINT_FILE
else
echo "Skipping update of endpoint with name: $ENDPOINT_NAME"
fi
}

# Identify which slot should be used to stage this deployment based on current traffic
echo "Reading endpoint traffic to identify target staging deployment slot"
az ml online-endpoint show -n $ENDPOINT_NAME --query "traffic" -o yaml > _endpoint_traffic.yml
echo "Endpoint traffic:"
cat _endpoint_traffic.yml
GREEN_TRAFFIC=$(yq .green _endpoint_traffic.yml)
BLUE_TRAFFIC=$(yq .blue _endpoint_traffic.yml)
if [[ $GREEN_TRAFFIC == null || $GREEN_TRAFFIC == 0 ]]; then
STAGING_DEPLOYMENT_NAME='green';
else
if [[ $BLUE_TRAFFIC == null || $BLUE_TRAFFIC == 0 ]]; then
STAGING_DEPLOYMENT_NAME='blue';
else
echo "::error::No staging slots available for endpoint $ENDPOINT_NAME. One of the green/blue slots needs to have 0% traffic.";
exit 1;
fi
fi
echo "Selected staging deployment name: $STAGING_DEPLOYMENT_NAME"

# Updating deployment file to setup name of deployment based on staging name selected above
echo "Updating deployment name to $STAGING_DEPLOYMENT_NAME"
if [[ $STAGING_DEPLOYMENT_NAME == "blue" ]]; then
yq -y -i '.name= "blue"' $DEPLOYMENT_FILE;
else
yq -y -i '.name= "green"' $DEPLOYMENT_FILE;
fi

# Overwrite the model version set in the deployment file with a specific version or 'latest' if specified in the workflow
DEPLOYMENT_MODEL=$(yq -r ".model" $DEPLOYMENT_FILE | cut -d: -f2)
DEPLOYMENT_MODEL_VERSION=$(yq -r ".model" $DEPLOYMENT_FILE | cut -d: -f3)
if [ -z "${{ inputs.modelVersion}}" ]; then
TARGET_MODEL_VERSION=$DEPLOYMENT_MODEL_VERSION
else
echo "Model being targeted is being overwriten with version ${{ inputs.modelVersion}}"
TARGET_MODEL_VERSION=${{ inputs.modelVersion}}
fi
if [[ "$TARGET_MODEL_VERSION" == "latest" ]]; then
echo "Identifying latest version of the model $DEPLOYMENT_MODEL"
TARGET_MODEL_VERSION=$(az ml model list --name $DEPLOYMENT_MODEL | jq -r '.[0].version')
echo "Latest version of model $DEPLOYMENT_MODEL is $TARGET_MODEL_VERSION"
fi
if [[ $TARGET_MODEL_VERSION != $DEPLOYMENT_MODEL_VERSION ]]; then
echo "Updating deployment file with model version: $TARGET_MODEL_VERSION"
sed -i 's/:'$DEPLOYMENT_MODEL_VERSION'/:'$TARGET_MODEL_VERSION'/' $DEPLOYMENT_FILE
fi
echo "::set-output name=deployedVersion::$TARGET_MODEL_VERSION"

# Create deployment
echo "Creating deployment with name: $ENDPOINT_NAME/$STAGING_DEPLOYMENT_NAME"
az ml online-deployment create -f $DEPLOYMENT_FILE --only-show-errors --set tags.git_commit=${GITHUB_SHA}
echo "Deployment completed"

# Get the deployment list and store it in a variable
#deployment_list=$(az ml online-deployment list -e $ENDPOINT_NAME)

# Check if the deployment list has items using jq
#if [[ $(echo "$deployment_list" | jq 'length > 0') == "true" ]]; then
# echo "Deployment $ENDPOINT_NAME already exists"
#else
# az ml online-deployment create -f $DEPLOYMENT_FILE --only-show-errors --set tags.git_commit=${GITHUB_SHA}
# echo "Deployment completed"
#fi

# Saving logs
echo "Acquiring logs for deployment with name: $ENDPOINT_NAME/$STAGING_DEPLOYMENT_NAME"
mkdir -p logs
az ml online-deployment get-logs --name $STAGING_DEPLOYMENT_NAME --endpoint-name $ENDPOINT_NAME >> logs/$ENDPOINT_NAME_$STAGING_DEPLOYMENT_NAME.log

- name: Upload deployment logs
uses: actions/upload-artifact@v4
if: ${{ (failure() || success()) }}
with:
name: deployment-logs
path: logs/*
114 changes: 57 additions & 57 deletions .github/actions/aml-endpoint-swap/action.yaml
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
name: Swap AzureML managed online endpoint deployments
description: 'Swaps green/blue deployments of an Azure ML endpoint by switching traffic around between endpoint deployments.'

inputs:
resourceGroup:
description: 'Name of the resource group where the workspace is placed.'
required: true
workspaceName:
description: 'Name of the workspace to work against.'
required: true
endpointFile:
description: 'Path to the endpoint YAML file. Wildcard paths are supported which means that all matched endpoints will be deployed.'
required: true

runs:
using: "composite"
steps:
- name: Swap endpoint deployments
id: swap-deployments
shell: bash
run: |
set -e
az configure --defaults workspace=${{ inputs.workspaceName }} group=${{ inputs.resourceGroup }}

ENDPOINT_FILE=${{ inputs.endpointFile }}
ENDPOINT_NAME=$(yq -r ".name" $ENDPOINT_FILE)
echo "ENDPOINT_FILE: $ENDPOINT_FILE"
echo "ENDPOINT_NAME: $ENDPOINT_NAME"

echo "Reading endpoint traffic to figure out which deployment is staging/production"
az ml online-endpoint show -n $ENDPOINT_NAME --query "traffic" -o yaml > endpoint_traffic.yml
echo "Endpoint traffic:"
cat endpoint_traffic.yml
GREEN_TRAFFIC=$(yq .green endpoint_traffic.yml)
BLUE_TRAFFIC=$(yq .blue endpoint_traffic.yml)

if [ $GREEN_TRAFFIC == null ]; then
if [ $BLUE_TRAFFIC == null ]; then
echo "::error::No deployment slots available for endpoint $ENDPOINT_NAME. Nothing to swap.";
exit 1;
else
echo "Setting blue traffic to 100%"
az ml online-endpoint update -n $ENDPOINT_NAME --traffic "blue=100"
fi
else
if [ $BLUE_TRAFFIC == null ]; then
echo "Setting green traffic to 100%"
az ml online-endpoint update -n $ENDPOINT_NAME --traffic "green=100"
else
if [ $GREEN_TRAFFIC == 0 ]; then
echo "Setting traffic to: green=100 blue=0"
az ml online-endpoint update -n $ENDPOINT_NAME --traffic "green=100 blue=0"
else
echo "Setting traffic to: green=0 blue=100"
az ml online-endpoint update -n $ENDPOINT_NAME --traffic "green=0 blue=100"
fi
fi
name: Swap AzureML managed online endpoint deployments
description: 'Swaps green/blue deployments of an Azure ML endpoint by switching traffic around between endpoint deployments.'
inputs:
resourceGroup:
description: 'Name of the resource group where the workspace is placed.'
required: true
workspaceName:
description: 'Name of the workspace to work against.'
required: true
endpointFile:
description: 'Path to the endpoint YAML file. Wildcard paths are supported which means that all matched endpoints will be deployed.'
required: true
runs:
using: "composite"
steps:
- name: Swap endpoint deployments
id: swap-deployments
shell: bash
run: |
set -e
az configure --defaults workspace=${{ inputs.workspaceName }} group=${{ inputs.resourceGroup }}
ENDPOINT_FILE=${{ inputs.endpointFile }}
ENDPOINT_NAME=$(yq -r ".name" $ENDPOINT_FILE)
echo "ENDPOINT_FILE: $ENDPOINT_FILE"
echo "ENDPOINT_NAME: $ENDPOINT_NAME"
echo "Reading endpoint traffic to figure out which deployment is staging/production"
az ml online-endpoint show -n $ENDPOINT_NAME --query "traffic" -o yaml > endpoint_traffic.yml
echo "Endpoint traffic:"
cat endpoint_traffic.yml
GREEN_TRAFFIC=$(yq .green endpoint_traffic.yml)
BLUE_TRAFFIC=$(yq .blue endpoint_traffic.yml)
if [ $GREEN_TRAFFIC == null ]; then
if [ $BLUE_TRAFFIC == null ]; then
echo "::error::No deployment slots available for endpoint $ENDPOINT_NAME. Nothing to swap.";
exit 1;
else
echo "Setting blue traffic to 100%"
az ml online-endpoint update -n $ENDPOINT_NAME --traffic "blue=100"
fi
else
if [ $BLUE_TRAFFIC == null ]; then
echo "Setting green traffic to 100%"
az ml online-endpoint update -n $ENDPOINT_NAME --traffic "green=100"
else
if [ $GREEN_TRAFFIC == 0 ]; then
echo "Setting traffic to: green=100 blue=0"
az ml online-endpoint update -n $ENDPOINT_NAME --traffic "green=100 blue=0"
else
echo "Setting traffic to: green=0 blue=100"
az ml online-endpoint update -n $ENDPOINT_NAME --traffic "green=0 blue=100"
fi
fi
fi
Loading