Skip to content

Commit e5ed2b3

Browse files
authored
Sample Pipeline: StepSequence Migration SDK v1 to SDK v2 (#3667)
- Demonstrates a multi-step pipeline with dummy inputs and outputs - Replicates the step sequence functionality available in AzureML SDK v1 - Serves as a reference for migrating pipelines from SDK v1 to SDK v2
1 parent 4df413c commit e5ed2b3

File tree

6 files changed

+589
-0
lines changed

6 files changed

+589
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: sdk-jobs-pipelines-stepsequence-pipeline_with_step_sequence_dummy_dependencies
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "0 */8 * * *"
6+
pull_request:
7+
branches:
8+
- main
9+
paths:
10+
- sdk/python/jobs/pipelines/stepsequence/pipeline_with_step_sequence_dummy_dependencies.ipynb
11+
- .github/workflows/sdk-jobs-pipelines-stepsequence-pipeline_with_step_sequence_dummy_dependencies.yml
12+
- "!sdk/python/jobs/pipelines/stepsequence/**/*.md"
13+
- sdk/python/dev-requirements.txt
14+
- infra/bootstrapping/**
15+
- sdk/python/setup.sh
16+
17+
permissions:
18+
id-token: write
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: check out repo
28+
uses: actions/checkout@v3
29+
- name: setup python
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: "3.10"
33+
- name: pip install notebook reqs
34+
run: pip install -r sdk/python/dev-requirements.txt
35+
- name: azure login
36+
uses: azure/login@v1
37+
with:
38+
client-id: ${{ secrets.OIDC_AZURE_CLIENT_ID }}
39+
tenant-id: ${{ secrets.OIDC_AZURE_TENANT_ID }}
40+
subscription-id: ${{ secrets.OIDC_AZURE_SUBSCRIPTION_ID }}
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/bootstrapping
46+
continue-on-error: false
47+
- name: setup SDK
48+
run: |
49+
source "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh";
50+
source "${{ github.workspace }}/infra/bootstrapping/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/bootstrapping/sdk_helpers.sh";
57+
source "${{ github.workspace }}/infra/bootstrapping/init_environment.sh";
58+
bash setup.sh
59+
working-directory: cli
60+
continue-on-error: true
61+
- name: Eagerly cache access tokens for required scopes
62+
run: |
63+
# Workaround for azure-cli's lack of support for ID token refresh
64+
# Taken from: https://github.com/Azure/login/issues/372#issuecomment-2056289617
65+
66+
# Management
67+
az account get-access-token --scope https://management.azure.com/.default --output none
68+
# ML
69+
az account get-access-token --scope https://ml.azure.com/.default --output none
70+
- name: install ml extension
71+
run: az extension add -n ml -y
72+
- name: run jobs/pipelines/stepsequence/pipeline_with_step_sequence_dummy_dependencies.ipynb
73+
run: |
74+
source "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh";
75+
source "${{ github.workspace }}/infra/bootstrapping/init_environment.sh";
76+
bash "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh" generate_workspace_config "../../.azureml/config.json";
77+
bash "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh" replace_template_values "pipeline_with_step_sequence_dummy_dependencies.ipynb";
78+
[ -f "../../.azureml/config" ] && cat "../../.azureml/config";
79+
papermill -k python pipeline_with_step_sequence_dummy_dependencies.ipynb pipeline_with_step_sequence_dummy_dependencies.output.ipynb
80+
working-directory: sdk/python/jobs/pipelines/stepsequence
81+
- name: upload notebook's working folder as an artifact
82+
if: ${{ always() }}
83+
uses: ./.github/actions/upload-artifact
84+
with:
85+
name: stepsequence
86+
path: sdk/python/jobs/pipelines/stepsequence

sdk/python/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ Test Status is for branch - **_main_**
265265
|jobs|pipelines|[nyc_taxi_data_regression](jobs/pipelines/2c_nyc_taxi_data_regression/nyc_taxi_data_regression.ipynb)|Build pipeline with components for 5 jobs - prep data, transform data, train model, predict results and evaluate model performance|[![nyc_taxi_data_regression](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-2c_nyc_taxi_data_regression-nyc_taxi_data_regression.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-2c_nyc_taxi_data_regression-nyc_taxi_data_regression.yml)|
266266
|jobs|pipelines|[image_classification_with_densenet](jobs/pipelines/2d_image_classification_with_densenet/image_classification_with_densenet.ipynb)|Create pipeline to train cnn image classification model|[![image_classification_with_densenet](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-2d_image_classification_with_densenet-image_classification_with_densenet.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-2d_image_classification_with_densenet-image_classification_with_densenet.yml)|
267267
|jobs|pipelines|[image_classification_keras_minist_convnet](jobs/pipelines/2e_image_classification_keras_minist_convnet/image_classification_keras_minist_convnet.ipynb)|Create pipeline to train cnn image classification model with keras|[![image_classification_keras_minist_convnet](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-2e_image_classification_keras_minist_convnet-image_classification_keras_minist_convnet.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-2e_image_classification_keras_minist_convnet-image_classification_keras_minist_convnet.yml)|
268+
|jobs|pipelines|[stepsequence](jobs/pipelines/stepsequence/pipeline_with_step_sequence_dummy_dependencies.ipynb)|Create pipeline demonstrating multi-step execution with dummy inputs/outputs, replicating AzureML SDK v1 step sequence behavior|[![stepsequence](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-stepsequence-pipeline_with_step_sequence_dummy_dependencies.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-stepsequence-pipeline_with_step_sequence_dummy_dependencies.yml)|
268269
|jobs|single-step|[lightgbm-iris-sweep](jobs/single-step/lightgbm/iris/lightgbm-iris-sweep.ipynb)|Run **hyperparameter sweep** on a Command or CommandComponent|[![lightgbm-iris-sweep](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-single-step-lightgbm-iris-lightgbm-iris-sweep.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-single-step-lightgbm-iris-lightgbm-iris-sweep.yml)|
269270
|jobs|single-step|[tutorial](jobs/single-step/pytorch/distributed-training-yolov5/yolov5/tutorial.ipynb)|*no description*|[![tutorial](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-single-step-pytorch-distributed-training-yolov5-yolov5-tutorial.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-single-step-pytorch-distributed-training-yolov5-yolov5-tutorial.yml)|
270271
|jobs|single-step|[distributed-cifar10](jobs/single-step/pytorch/distributed-training/distributed-cifar10.ipynb)|*no description*|[![distributed-cifar10](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-single-step-pytorch-distributed-training-distributed-cifar10.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-single-step-pytorch-distributed-training-distributed-cifar10.yml)|
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
page_type: sample
3+
languages:
4+
- python
5+
products:
6+
- azure-machine-learning
7+
description: This sample shows how to run build pipeline with command_component decorator.
8+
---
9+
10+
# Running a Pipeline job with step sequences and dummy dependencies
11+
This example shows how to create a pipeline with step sequences and dummy dependencies using Azure ML Python SDK v2..
12+
13+
Please find the sample defined in [pipeline_with_step_sequence_dummy_dependencies.ipynb](pipeline_with_step_sequence_dummy_dependencies.ipynb).
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
$schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json
2+
name: echo_component
3+
display_name: Echo Hello
4+
version: 1
5+
type: command
6+
description: A component that just echoes hello
7+
8+
outputs:
9+
output_data:
10+
type: uri_folder
11+
12+
command: echo "hello" > ${{outputs.output_data}}/message.txt
13+
14+
environment: azureml://registries/azureml/environments/sklearn-1.5/labels/latest
17.4 KB
Loading

0 commit comments

Comments
 (0)