4
4
5
5
# <set_variables>
6
6
export ENDPOINT_NAME=" <YOUR_ENDPOINT_NAME>"
7
+ export DEPLOYMENT_NAME=" <YOUR_DEPLOYMENT_NAME>"
7
8
# </set_variables>
8
9
9
10
export ENDPOINT_NAME=endpt-` echo $RANDOM `
11
+ export DEPLOYMENT_NAME=" mnist-torch-dpl"
10
12
11
13
echo " Creating compute"
12
14
# <create_compute>
@@ -20,7 +22,7 @@ az ml batch-endpoint create --name $ENDPOINT_NAME
20
22
21
23
echo " Creating batch deployment nonmlflowdp for endpoint $ENDPOINT_NAME "
22
24
# <create_batch_deployment_set_default>
23
- az ml batch-deployment create --name nonmlflowdp --endpoint-name $ENDPOINT_NAME -- file endpoints/batch/nonmlflow- deployment.yml --set-default
25
+ az ml batch-deployment create --file endpoints/batch/mnist-torch- deployment.yml --endpoint-name $ENDPOINT_NAME --set-default
24
26
# </create_batch_deployment_set_default>
25
27
26
28
echo " Showing details of the batch endpoint"
@@ -30,7 +32,7 @@ az ml batch-endpoint show --name $ENDPOINT_NAME
30
32
31
33
echo " Showing details of the batch deployment"
32
34
# <check_batch_deployment_detail>
33
- az ml batch-deployment show --name nonmlflowdp --endpoint-name $ENDPOINT_NAME
35
+ az ml batch-deployment show --name $DEPLOYMENT_NAME --endpoint-name $ENDPOINT_NAME
34
36
# </check_batch_deployment_detail>
35
37
36
38
echo " Invoking batch endpoint with public URI (MNIST)"
67
69
echo " Invoke batch endpoint with specific output file name"
68
70
# <start_batch_scoring_job_configure_output_settings>
69
71
export OUTPUT_FILE_NAME=predictions_` echo $RANDOM ` .csv
70
- JOB_NAME=$( az ml batch-endpoint invoke --name $ENDPOINT_NAME --input https://pipelinedata.blob.core.windows.net/sampledata/mnist --input-type uri_folder --output-path azureml://datastores/workspaceblobstore/paths/$ENDPOINT_NAME --set output_file_name=$OUTPUT_FILE_NAME --mini-batch-size 20 --instance-count 5 -- query name -o tsv)
72
+ JOB_NAME=$( az ml batch-endpoint invoke --name $ENDPOINT_NAME --input https://pipelinedata.blob.core.windows.net/sampledata/mnist --input-type uri_folder --output-path azureml://datastores/workspaceblobstore/paths/$ENDPOINT_NAME --set output_file_name=$OUTPUT_FILE_NAME --query name -o tsv)
71
73
# </start_batch_scoring_job_configure_output_settings>
72
74
75
+ echo " Invoke batch endpoint with specific overwrites"
76
+ # <start_batch_scoring_job_overwrite>
77
+ export OUTPUT_FILE_NAME=predictions_` echo $RANDOM ` .csv
78
+ JOB_NAME=$( az ml batch-endpoint invoke --name $ENDPOINT_NAME --input https://pipelinedata.blob.core.windows.net/sampledata/mnist --input-type uri_folder --mini-batch-size 20 --instance-count 5 --query name -o tsv)
79
+ # </start_batch_scoring_job_overwrite>
80
+
73
81
echo " Stream job detail"
74
82
# <stream_job_logs_to_console>
75
83
az ml job stream -n $JOB_NAME
93
101
94
102
echo " List all jobs under the batch deployment"
95
103
# <list_all_jobs>
96
- az ml batch-deployment list-jobs --name nonmlflowdp --endpoint-name $ENDPOINT_NAME --query [].name
104
+ az ml batch-deployment list-jobs --name $DEPLOYMENT_NAME --endpoint-name $ENDPOINT_NAME --query [].name
97
105
# </list_all_jobs>
98
106
99
- echo " Create a new batch deployment (mlflow-nyctaxi ), not setting it as default this time"
107
+ echo " Create a new batch deployment (mnist-keras-dpl ), not setting it as default this time"
100
108
# <create_new_deployment_not_default>
101
- az ml batch-deployment create --name mlflowdp --endpoint-name $ENDPOINT_NAME -- file endpoints/batch/mlflow- deployment.yml
109
+ az ml batch-deployment create --file endpoints/batch/mnist-keras- deployment.yml --endpoint-name $ENDPOINT_NAME
102
110
# </create_new_deployment_not_default>
103
111
104
112
echo " Invoke batch endpoint with public data"
105
113
# <test_new_deployment>
106
- JOB_NAME=$( az ml batch-endpoint invoke --name $ENDPOINT_NAME --deployment-name mlflowdp --input https://pipelinedata.blob.core.windows.net/sampledata/nytaxi/taxi-tip-data.csv --input-type uri_file --query name -o tsv)
114
+ DEPLOYMENT_NAME=" mnist-keras-dpl"
115
+ JOB_NAME=$( az ml batch-endpoint invoke --name $ENDPOINT_NAME --deployment-name $DEPLOYMENT_NAME --input https://pipelinedata.blob.core.windows.net/sampledata/mnist --input-type uri_folder --query name -o tsv)
116
+ # </test_new_deployment>
107
117
108
118
echo " Show job detail"
109
119
# <show_job_in_studio>
@@ -130,30 +140,20 @@ else
130
140
exit 2
131
141
fi
132
142
# </check_job_status>
133
- # </test_new_deployment>
134
143
135
144
echo " Update the batch deployment as default for the endpoint"
136
145
# <update_default_deployment>
137
- az ml batch-endpoint update --name $ENDPOINT_NAME --set defaults.deployment_name=mlflowdp
146
+ az ml batch-endpoint update --name $ENDPOINT_NAME --set defaults.deployment_name=$DEPLOYMENT_NAME
138
147
# </update_default_deployment>
139
148
140
149
echo " Verify default deployment. In this example, it should be mlflowdp."
141
150
# <verify_default_deployment>
142
151
az ml batch-endpoint show --name $ENDPOINT_NAME --query " {Name:name, Defaults:defaults}"
143
-
144
- DEFAULT_DEPL_NAME=$( az ml batch-endpoint show --name $ENDPOINT_NAME --query defaults.deployment_name)
145
- if [[ $DEFAULT_DEPL_NAME == \" mlflowdp\" ]]
146
- then
147
- echo " mlflowdp is set as default successfully"
148
- else
149
- echo " default deployment set failed"
150
- exit 1
151
- fi
152
152
# </verify_default_deployment>
153
153
154
154
echo " Invoke batch endpoint with the new default deployment with public URI"
155
155
# <test_new_default_deployment>
156
- JOB_NAME=$( az ml batch-endpoint invoke --name $ENDPOINT_NAME --input https://pipelinedata.blob.core.windows.net/sampledata/nytaxi/taxi-tip-data.csv --input-type uri_file --query name -o tsv)
156
+ JOB_NAME=$( az ml batch-endpoint invoke --name $ENDPOINT_NAME --input https://pipelinedata.blob.core.windows.net/sampledata/mnist --input-type uri_folder --query name -o tsv)
157
157
# </test_new_default_deployment>
158
158
159
159
echo " Stream job logs to console"
@@ -196,7 +196,7 @@ RESPONSE=$(curl --location --request POST "$SCORING_URI" \
196
196
\" properties\" : {
197
197
\" dataset\" : {
198
198
\" dataInputType\" : \" DataUrl\" ,
199
- \" Path\" : \" https://pipelinedata.blob.core.windows.net/sampledata/nytaxi/taxi-tip-data.csv \"
199
+ \" Path\" : \" https://pipelinedata.blob.core.windows.net/sampledata/mnist \"
200
200
}
201
201
}
202
202
}" )
0 commit comments