generated from databricks-industry-solutions/industry-solutions-blueprints
-
Notifications
You must be signed in to change notification settings - Fork 5
/
azure-pipelines.yml
58 lines (46 loc) · 1.54 KB
/
azure-pipelines.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Sample pipeline that grabs a model from MLFlow, creates a Docker image and uploads it to Azure Container Registry
# These parameters are set by the MLFlow webhook that calls this pipeline
parameters:
- name: run_id
type: string
- name: model_version
type: string
- name: databricks_host
type: string
- name: databricks_token
type: string
trigger: none
pool:
vmImage: ubuntu-latest
steps:
- script: echo Parameters sent to pipeline ${{ parameters.run_id }} and ${{ parameters.model_version }}
displayName: 'Display parameters'
- task: DockerInstaller@0
inputs:
dockerVersion: '17.09.0-ce'
- script: pip install mlflow
displayName: 'Installing dependencies'
enabled: 'true'
- script: |
export MLFLOW_TRACKING_URI=databricks
export DATABRICKS_HOST=${{ parameters.databricks_host }}
export DATABRICKS_TOKEN=${{ parameters.databricks_token }}
mlflow artifacts download -r "${{ parameters.run_id }}" -d "model_dir"
ls -la
displayName: 'Configure MLFlow environmental variables'
enabled: 'true'
- script: |
mlflow models generate-dockerfile -m "model_dir/model/" -d "mlflow_docker" --enable-mlserver
displayName: 'Create Dockerfile'
enabled: 'true'
- script: |
docker build -t "solacc.azurecr.io/ml-model:v.${{ parameters.model_version }}" mlflow_docker/
displayName: 'Create Docker Image'
enabled: 'true'
- task: Docker@2
displayName: 'Push Docker Image to ACR'
inputs:
containerRegistry: 'solacc_acr'
repository: 'ml-model'
command: 'push'
tags: 'v.${{ parameters.model_version }}'