66 строки
1.8 KiB
Bash
66 строки
1.8 KiB
Bash
set -e
|
|
|
|
BASE_PATH=endpoints/online/triton/single-model
|
|
|
|
# <installing-requirements>
|
|
pip install numpy
|
|
pip install tritonclient[http]
|
|
pip install pillow
|
|
pip install gevent
|
|
# </installing-requirements>
|
|
|
|
# <set_endpoint_name>
|
|
export ENDPOINT_NAME=triton-single-endpt-`echo $RANDOM`
|
|
# </set_endpoint_name>
|
|
|
|
# <create_endpoint>
|
|
az ml online-endpoint create -n $ENDPOINT_NAME -f $BASE_PATH/create-managed-endpoint.yaml
|
|
# </create_endpoint>
|
|
|
|
# <create_deployment>
|
|
az ml online-deployment create --name blue --endpoint $ENDPOINT_NAME -f $BASE_PATH/create-managed-deployment.yaml --all-traffic
|
|
# </create_deployment>
|
|
|
|
# <get_status>
|
|
az ml online-endpoint show -n $ENDPOINT_NAME
|
|
# </get_status>
|
|
|
|
# check if create was successful
|
|
endpoint_status=`az ml online-endpoint show --name $ENDPOINT_NAME --query "provisioning_state" -o tsv`
|
|
echo $endpoint_status
|
|
if [[ $endpoint_status == "Succeeded" ]]
|
|
then
|
|
echo "Endpoint created successfully"
|
|
else
|
|
echo "Endpoint creation failed"
|
|
exit 1
|
|
fi
|
|
|
|
deploy_status=`az ml online-deployment show --name blue --endpoint $ENDPOINT_NAME --query "provisioning_state" -o tsv`
|
|
echo $deploy_status
|
|
if [[ $deploy_status == "Succeeded" ]]
|
|
then
|
|
echo "Deployment completed successfully"
|
|
else
|
|
echo "Deployment failed"
|
|
exit 1
|
|
fi
|
|
|
|
# <get_scoring_uri>
|
|
scoring_uri=$(az ml online-endpoint show -n $ENDPOINT_NAME --query scoring_uri -o tsv)
|
|
scoring_uri=${scoring_uri%/*}
|
|
# </get_scoring_uri>
|
|
|
|
# <get_token>
|
|
auth_token=$(az ml online-endpoint get-credentials -n $ENDPOINT_NAME --query accessToken -o tsv)
|
|
# </get_token>
|
|
|
|
# <check_scoring_of_model>
|
|
python $BASE_PATH/triton_densenet_scoring.py --base_url=$scoring_uri --token=$auth_token --image_path $BASE_PATH/data/peacock.jpg
|
|
# </check_scoring_of_model>
|
|
|
|
# <delete_endpoint>
|
|
az ml online-endpoint delete -n $ENDPOINT_NAME --yes
|
|
# </delete_endpoint>
|
|
|