-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
diabetes_regression-package-model-template.yml
42 lines (38 loc) · 1.5 KB
/
diabetes_regression-package-model-template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Pipeline template that creates a model package and adds the package location to the environment for subsequent tasks to use.
parameters:
- name: modelId
type: string
default: ''
- name: scoringScriptPath
type: string
default: ''
- name: condaFilePath
type: string
default: ''
steps:
- task: AzureCLI@1
displayName: 'Install AzureML CLI'
inputs:
azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
scriptLocation: inlineScript
workingDirectory: $(Build.SourcesDirectory)
inlineScript: 'az extension add --source https://azurecliext.blob.core.windows.net/release/azure_cli_ml-1.27.0-py3-none-any.whl --yes'
- task: AzureCLI@1
displayName: 'Create model package and set IMAGE_LOCATION variable'
inputs:
azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
scriptLocation: inlineScript
inlineScript: |
set -e # fail on error
# Create model package using CLI
az ml model package --workspace-name $(WORKSPACE_NAME) -g $(RESOURCE_GROUP) \
--model '${{ parameters.modelId }}' \
--entry-script '${{ parameters.scoringScriptPath }}' \
--cf '${{ parameters.condaFilePath }}' \
-v \
--rt python --query 'location' -o tsv > image_logs.txt
# Show logs
cat image_logs.txt
# Set environment variable using the last line of logs that has the package location
IMAGE_LOCATION=$(tail -n 1 image_logs.txt)
echo "##vso[task.setvariable variable=IMAGE_LOCATION]$IMAGE_LOCATION"