Skip to content

Commit 7a7ad56

Browse files
santiagxfsantiagxf
and
santiagxf
authored
Santiagxf/batch pup (#2269)
* pipelines * fix * fixes * snppets * tests * models * models * example * example * name * fixes * sdk * tags * fix * batchv2 * fixes * fixes * fix * fixes * fixes * fixes * build * changes * fixes * fixes * build * black * wait * compute * pandas * review * build * readme * sample * scripts * review --------- Co-authored-by: santiagxf <[email protected]>
1 parent 0c56b57 commit 7a7ad56

File tree

103 files changed

+8251
-53177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+8251
-53177
lines changed

.github/workflows/sdk-endpoints-batch-deploy-models-heart-classifier-mlflow-mlflow-for-batch-tabular.yml

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ jobs:
3434
python-version: "3.8"
3535
- name: pip install notebook reqs
3636
run: pip install -r sdk/python/dev-requirements.txt
37+
- name: pip install mlflow reqs
38+
run: pip install -r sdk/python/mlflow-requirements.txt
3739
- name: azure login
3840
uses: azure/login@v1
3941
with:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# This code is autogenerated.
2+
# Code is generated by running custom script: python3 readme.py
3+
# Any manual changes to this file may cause incorrect behavior.
4+
# Any manual changes will be overwritten if the code is regenerated.
5+
6+
name: sdk-endpoints-batch-deploy-pipelines-batch-scoring-with-preprocessing-sdk-deploy-and-test
7+
# This file is created by sdk/python/readme.py.
8+
# Please do not edit directly.
9+
on:
10+
workflow_dispatch:
11+
schedule:
12+
- cron: "29 5/12 * * *"
13+
pull_request:
14+
branches:
15+
- main
16+
paths:
17+
- sdk/python/endpoints/batch/deploy-pipelines/batch-scoring-with-preprocessing/**
18+
- .github/workflows/sdk-endpoints-batch-deploy-pipelines-batch-scoring-with-preprocessing-sdk-deploy-and-test.yml
19+
- sdk/python/dev-requirements.txt
20+
- infra/**
21+
- sdk/python/setup.sh
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
24+
cancel-in-progress: true
25+
jobs:
26+
build:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: check out repo
30+
uses: actions/checkout@v2
31+
- name: setup python
32+
uses: actions/setup-python@v2
33+
with:
34+
python-version: "3.8"
35+
- name: pip install notebook reqs
36+
run: pip install -r sdk/python/dev-requirements.txt
37+
- name: azure login
38+
uses: azure/login@v1
39+
with:
40+
creds: ${{secrets.AZUREML_CREDENTIALS}}
41+
- name: bootstrap resources
42+
run: |
43+
echo '${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}';
44+
bash bootstrap.sh
45+
working-directory: infra
46+
continue-on-error: false
47+
- name: setup SDK
48+
run: |
49+
source "${{ github.workspace }}/infra/sdk_helpers.sh";
50+
source "${{ github.workspace }}/infra/init_environment.sh";
51+
bash setup.sh
52+
working-directory: sdk/python
53+
continue-on-error: true
54+
- name: setup-cli
55+
run: |
56+
source "${{ github.workspace }}/infra/sdk_helpers.sh";
57+
source "${{ github.workspace }}/infra/init_environment.sh";
58+
bash setup.sh
59+
working-directory: cli
60+
continue-on-error: true
61+
- name: run endpoints/batch/deploy-pipelines/batch-scoring-with-preprocessing/sdk-deploy-and-test.ipynb
62+
run: |
63+
source "${{ github.workspace }}/infra/sdk_helpers.sh";
64+
source "${{ github.workspace }}/infra/init_environment.sh";
65+
bash "${{ github.workspace }}/infra/sdk_helpers.sh" generate_workspace_config "../../.azureml/config.json";
66+
bash "${{ github.workspace }}/infra/sdk_helpers.sh" replace_template_values "sdk-deploy-and-test.ipynb";
67+
[ -f "../../.azureml/config" ] && cat "../../.azureml/config";
68+
papermill -k python sdk-deploy-and-test.ipynb sdk-deploy-and-test.output.ipynb
69+
working-directory: sdk/python/endpoints/batch/deploy-pipelines/batch-scoring-with-preprocessing
70+
- name: upload notebook's working folder as an artifact
71+
if: ${{ always() }}
72+
uses: actions/upload-artifact@v2
73+
with:
74+
name: sdk-deploy-and-test
75+
path: sdk/python/endpoints/batch/deploy-pipelines/batch-scoring-with-preprocessing
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# This code is autogenerated.
2+
# Code is generated by running custom script: python3 readme.py
3+
# Any manual changes to this file may cause incorrect behavior.
4+
# Any manual changes will be overwritten if the code is regenerated.
5+
6+
name: sdk-endpoints-batch-deploy-pipelines-hello-batch-sdk-deploy-and-test
7+
# This file is created by sdk/python/readme.py.
8+
# Please do not edit directly.
9+
on:
10+
workflow_dispatch:
11+
schedule:
12+
- cron: "29 5/12 * * *"
13+
pull_request:
14+
branches:
15+
- main
16+
paths:
17+
- sdk/python/endpoints/batch/deploy-pipelines/hello-batch/**
18+
- .github/workflows/sdk-endpoints-batch-deploy-pipelines-hello-batch-sdk-deploy-and-test.yml
19+
- sdk/python/dev-requirements.txt
20+
- infra/**
21+
- sdk/python/setup.sh
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
24+
cancel-in-progress: true
25+
jobs:
26+
build:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: check out repo
30+
uses: actions/checkout@v2
31+
- name: setup python
32+
uses: actions/setup-python@v2
33+
with:
34+
python-version: "3.8"
35+
- name: pip install notebook reqs
36+
run: pip install -r sdk/python/dev-requirements.txt
37+
- name: azure login
38+
uses: azure/login@v1
39+
with:
40+
creds: ${{secrets.AZUREML_CREDENTIALS}}
41+
- name: bootstrap resources
42+
run: |
43+
echo '${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}';
44+
bash bootstrap.sh
45+
working-directory: infra
46+
continue-on-error: false
47+
- name: setup SDK
48+
run: |
49+
source "${{ github.workspace }}/infra/sdk_helpers.sh";
50+
source "${{ github.workspace }}/infra/init_environment.sh";
51+
bash setup.sh
52+
working-directory: sdk/python
53+
continue-on-error: true
54+
- name: setup-cli
55+
run: |
56+
source "${{ github.workspace }}/infra/sdk_helpers.sh";
57+
source "${{ github.workspace }}/infra/init_environment.sh";
58+
bash setup.sh
59+
working-directory: cli
60+
continue-on-error: true
61+
- name: run endpoints/batch/deploy-pipelines/hello-batch/sdk-deploy-and-test.ipynb
62+
run: |
63+
source "${{ github.workspace }}/infra/sdk_helpers.sh";
64+
source "${{ github.workspace }}/infra/init_environment.sh";
65+
bash "${{ github.workspace }}/infra/sdk_helpers.sh" generate_workspace_config "../../.azureml/config.json";
66+
bash "${{ github.workspace }}/infra/sdk_helpers.sh" replace_template_values "sdk-deploy-and-test.ipynb";
67+
[ -f "../../.azureml/config" ] && cat "../../.azureml/config";
68+
papermill -k python sdk-deploy-and-test.ipynb sdk-deploy-and-test.output.ipynb
69+
working-directory: sdk/python/endpoints/batch/deploy-pipelines/hello-batch
70+
- name: upload notebook's working folder as an artifact
71+
if: ${{ always() }}
72+
uses: actions/upload-artifact@v2
73+
with:
74+
name: sdk-deploy-and-test
75+
path: sdk/python/endpoints/batch/deploy-pipelines/hello-batch
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# This code is autogenerated.
2+
# Code is generated by running custom script: python3 readme.py
3+
# Any manual changes to this file may cause incorrect behavior.
4+
# Any manual changes will be overwritten if the code is regenerated.
5+
6+
name: sdk-endpoints-batch-deploy-pipelines-training-with-components-sdk-deploy-and-test
7+
# This file is created by sdk/python/readme.py.
8+
# Please do not edit directly.
9+
on:
10+
workflow_dispatch:
11+
schedule:
12+
- cron: "29 5/12 * * *"
13+
pull_request:
14+
branches:
15+
- main
16+
paths:
17+
- sdk/python/endpoints/batch/deploy-pipelines/training-with-components/**
18+
- .github/workflows/sdk-endpoints-batch-deploy-pipelines-training-with-components-sdk-deploy-and-test.yml
19+
- sdk/python/dev-requirements.txt
20+
- infra/**
21+
- sdk/python/setup.sh
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
24+
cancel-in-progress: true
25+
jobs:
26+
build:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: check out repo
30+
uses: actions/checkout@v2
31+
- name: setup python
32+
uses: actions/setup-python@v2
33+
with:
34+
python-version: "3.8"
35+
- name: pip install notebook reqs
36+
run: pip install -r sdk/python/dev-requirements.txt
37+
- name: azure login
38+
uses: azure/login@v1
39+
with:
40+
creds: ${{secrets.AZUREML_CREDENTIALS}}
41+
- name: bootstrap resources
42+
run: |
43+
echo '${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}';
44+
bash bootstrap.sh
45+
working-directory: infra
46+
continue-on-error: false
47+
- name: setup SDK
48+
run: |
49+
source "${{ github.workspace }}/infra/sdk_helpers.sh";
50+
source "${{ github.workspace }}/infra/init_environment.sh";
51+
bash setup.sh
52+
working-directory: sdk/python
53+
continue-on-error: true
54+
- name: setup-cli
55+
run: |
56+
source "${{ github.workspace }}/infra/sdk_helpers.sh";
57+
source "${{ github.workspace }}/infra/init_environment.sh";
58+
bash setup.sh
59+
working-directory: cli
60+
continue-on-error: true
61+
- name: run endpoints/batch/deploy-pipelines/training-with-components/sdk-deploy-and-test.ipynb
62+
run: |
63+
source "${{ github.workspace }}/infra/sdk_helpers.sh";
64+
source "${{ github.workspace }}/infra/init_environment.sh";
65+
bash "${{ github.workspace }}/infra/sdk_helpers.sh" generate_workspace_config "../../.azureml/config.json";
66+
bash "${{ github.workspace }}/infra/sdk_helpers.sh" replace_template_values "sdk-deploy-and-test.ipynb";
67+
[ -f "../../.azureml/config" ] && cat "../../.azureml/config";
68+
papermill -k python sdk-deploy-and-test.ipynb sdk-deploy-and-test.output.ipynb
69+
working-directory: sdk/python/endpoints/batch/deploy-pipelines/training-with-components
70+
- name: upload notebook's working folder as an artifact
71+
if: ${{ always() }}
72+
uses: actions/upload-artifact@v2
73+
with:
74+
name: sdk-deploy-and-test
75+
path: sdk/python/endpoints/batch/deploy-pipelines/training-with-components

cli/endpoints/batch/deploy-models/custom-outputs-parquet/deploy-and-run.sh

+22-18
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ set -e
44
export ENDPOINT_NAME="<YOUR_ENDPOINT_NAME>"
55
# </set_variables>
66

7+
# <name_endpoint>
8+
ENDPOINT_NAME="heart-classifier-custom"
9+
# </name_endpoint>
10+
711
# The following code ensures the created deployment has a unique name
812
ENDPOINT_SUFIX=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-5} | head -n 1)
9-
ENDPOINT_NAME="heart-classifier-$ENDPOINT_SUFIX"
13+
ENDPOINT_NAME="$ENDPOINT_NAME-$ENDPOINT_SUFIX"
1014

1115
# <register_model>
1216
MODEL_NAME='heart-classifier-sklpipe'
@@ -19,30 +23,30 @@ az ml compute create -n batch-cluster --type amlcompute --min-instances 0 --max-
1923
# </create_compute>
2024

2125
echo "Creating batch endpoint $ENDPOINT_NAME"
22-
# <create_batch_endpoint>
26+
# <create_endpoint>
2327
az ml batch-endpoint create -n $ENDPOINT_NAME -f endpoint.yml
24-
# </create_batch_endpoint>
28+
# </create_endpoint>
29+
30+
echo "Showing details of the batch endpoint"
31+
# <query_endpoint>
32+
az ml batch-endpoint show --name $ENDPOINT_NAME
33+
# </query_endpoint>
2534

2635
echo "Creating batch deployment $DEPLOYMENT_NAME for endpoint $ENDPOINT_NAME"
27-
# <create_batch_deployment_set_default>
36+
# <create_deployment>
2837
az ml batch-deployment create --file deployment.yml --endpoint-name $ENDPOINT_NAME --set-default
29-
# </create_batch_deployment_set_default>
38+
# </create_deployment>
3039

3140
echo "Update the batch deployment as default for the endpoint"
32-
# <update_default_deployment>
41+
# <set_default_deployment>
3342
DEPLOYMENT_NAME="classifier-xgboost-custom"
3443
az ml batch-endpoint update --name $ENDPOINT_NAME --set defaults.deployment_name=$DEPLOYMENT_NAME
35-
# </update_default_deployment>
36-
37-
echo "Showing details of the batch endpoint"
38-
# <check_batch_endpooint_detail>
39-
az ml batch-endpoint show --name $ENDPOINT_NAME
40-
# </check_batch_endpooint_detail>
44+
# </set_default_deployment>
4145

4246
echo "Showing details of the batch deployment"
43-
# <check_batch_deployment_detail>
47+
# <query_deployment>
4448
az ml batch-deployment show --name $DEPLOYMENT_NAME --endpoint-name $ENDPOINT_NAME
45-
# </check_batch_deployment_detail>
49+
# </query_deployment>
4650

4751
echo "Invoking batch endpoint"
4852
# <start_batch_scoring_job>
@@ -60,9 +64,9 @@ az ml batch-deployment list-jobs --name $DEPLOYMENT_NAME --endpoint-name $ENDPOI
6064
# </list_all_jobs>
6165

6266
echo "Stream job logs to console"
63-
# <stream_job_logs_to_console>
67+
# <stream_job_logs>
6468
az ml job stream -n $JOB_NAME
65-
# </stream_job_logs_to_console>
69+
# </stream_job_logs>
6670

6771
# <check_job_status>
6872
STATUS=$(az ml job show -n $JOB_NAME --query status -o tsv)
@@ -81,9 +85,9 @@ fi
8185
# </check_job_status>
8286

8387
echo "Download scores to local path"
84-
# <download_scores>
88+
# <download_outputs>
8589
az ml job download --name $JOB_NAME --output-name score --download-path ./
86-
# </download_scores>
90+
# </download_outputs>
8791

8892
echo "Delete resources"
8993
# <delete_endpoint>

cli/endpoints/batch/deploy-models/custom-outputs-parquet/deployment.yml

+10-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ $schema: https://azuremlschemas.azureedge.net/latest/batchDeployment.schema.json
22
endpoint_name: heart-classifier-batch
33
name: classifier-xgboost-custom
44
description: A heart condition classifier based on XGBoost and Scikit-Learn pipelines that append predictions on parquet files.
5+
type: model
56
model: azureml:heart-classifier-sklpipe@latest
67
environment:
78
name: batch-mlflow-xgboost
@@ -13,11 +14,12 @@ code_configuration:
1314
compute: azureml:batch-cluster
1415
resources:
1516
instance_count: 2
16-
max_concurrency_per_instance: 2
17-
mini_batch_size: 2
18-
output_action: summary_only
19-
retry_settings:
20-
max_retries: 3
21-
timeout: 300
22-
error_threshold: -1
23-
logging_level: info
17+
settings:
18+
max_concurrency_per_instance: 2
19+
mini_batch_size: 2
20+
output_action: summary_only
21+
retry_settings:
22+
max_retries: 3
23+
timeout: 300
24+
error_threshold: -1
25+
logging_level: info

0 commit comments

Comments
 (0)