diff --git a/.pipelines/azdo-ci-build-train.yml b/.pipelines/azdo-ci-build-train.yml index d1d92d74..08ef5b82 100644 --- a/.pipelines/azdo-ci-build-train.yml +++ b/.pipelines/azdo-ci-build-train.yml @@ -12,7 +12,7 @@ trigger: variables: - template: azdo-variables.yml -- group: devopsforai-aml-vg +- group: 'devops_ml_vg' stages: @@ -62,13 +62,13 @@ stages: variables: AMLPIPELINE_ID: $[ dependencies.Get_Pipeline_ID.outputs['getpipelineid.AMLPIPELINEID'] ] steps: - - task: ms-air-aiagility.vss-services-azureml.azureml-restApi-task.MLPublishedPipelineRestAPITask@0 + - task: MLPublishedPipelineRestAPITask@0 displayName: 'Invoke ML pipeline' inputs: azureSubscription: '$(WORKSPACE_SVC_CONNECTION)' PipelineId: '$(AMLPIPELINE_ID)' ExperimentName: '$(EXPERIMENT_NAME)' - PipelineParameters: '"model_name": "sklearn_regression_model.pkl"' + PipelineParameters: '"model_name": "$(MODEL_NAME)"' - job: "Training_Run_Report" dependsOn: "Run_ML_Pipeline" displayName: "Determine if evaluation succeeded and new model is registered" @@ -95,4 +95,4 @@ stages: ArtifactName: 'mlops-pipelines' publishLocation: 'container' pathtoPublish: '$(Build.ArtifactStagingDirectory)' - TargetPath: '$(Build.ArtifactStagingDirectory)' \ No newline at end of file + TargetPath: '$(Build.ArtifactStagingDirectory)' diff --git a/ci-build.yml b/ci-build.yml new file mode 100644 index 00000000..53143b53 --- /dev/null +++ b/ci-build.yml @@ -0,0 +1,98 @@ +pr: none +trigger: + branches: + include: + - master + paths: + exclude: + - docs/ + - environment_setup/ + - charts/ + - ml_service/util/create_scoring_image.py + +variables: +- template: azdo-variables.yml +- group: 'devops_ml_vg' + + +stages: +- stage: 'Model_CI' + displayName: 'Model CI' + jobs: + - job: "Model_CI_Pipeline" + displayName: "Model CI Pipeline" + pool: + vmImage: 'ubuntu-latest' + container: mcr.microsoft.com/mlops/python:latest + timeoutInMinutes: 0 + steps: + - template: azdo-base-pipeline.yml + - script: | + # Invoke the Python building and publishing a training pipeline + python3 $(Build.SourcesDirectory)/ml_service/pipelines/${{ variables.BUILD_TRAIN_SCRIPT }} + failOnStderr: 'false' + env: + SP_APP_SECRET: '$(SP_APP_SECRET)' + displayName: 'Publish Azure Machine Learning Pipeline' +- stage: 'Trigger_AML_Pipeline' + displayName: 'Train, evaluate, register model via previously published AML pipeline' + jobs: + - job: "Get_Pipeline_ID" + condition: and(succeeded(), eq(coalesce(variables['auto-trigger-training'], 'true'), 'true')) + displayName: "Get Pipeline ID for execution" + pool: + vmImage: 'ubuntu-latest' + container: mcr.microsoft.com/mlops/python:latest + timeoutInMinutes: 0 + steps: + - script: | + python $(Build.SourcesDirectory)/ml_service/pipelines/run_train_pipeline.py + # Set AMLPIPELINEID variable for next AML Pipeline task in next job + source $(Build.SourcesDirectory)/tmp.sh + echo "##vso[task.setvariable variable=AMLPIPELINEID;isOutput=true]$AMLPIPELINE_ID" + rm $(Build.SourcesDirectory)/tmp.sh + name: 'getpipelineid' + displayName: 'Get Pipeline ID' + env: + SP_APP_SECRET: '$(SP_APP_SECRET)' + - job: "Run_ML_Pipeline" + dependsOn: "Get_Pipeline_ID" + displayName: "Trigger ML Training Pipeline" + pool: server + variables: + AMLPIPELINE_ID: $[ dependencies.Get_Pipeline_ID.outputs['getpipelineid.AMLPIPELINEID'] ] + steps: + - task: ms-air-aiagility.vss-services-azureml.azureml-restApi-task.MLPublishedPipelineRestAPITask@0 + displayName: 'Invoke ML pipeline' + inputs: + azureSubscription: '$(WORKSPACE_SVC_CONNECTION)' + PipelineId: '$(AMLPIPELINE_ID)' + ExperimentName: '$(EXPERIMENT_NAME)' + PipelineParameters: '"model_name": "sklearn_regression_model.pkl"' + - job: "Training_Run_Report" + dependsOn: "Run_ML_Pipeline" + displayName: "Determine if evaluation succeeded and new model is registered" + pool: + vmImage: 'ubuntu-latest' + container: mcr.microsoft.com/mlops/python:latest + timeoutInMinutes: 0 + steps: + - script: | + python $(Build.SourcesDirectory)/code/register/register_model.py --build_id $(Build.BuildId) --validate True + displayName: 'Check if new model registered' + env: + SP_APP_SECRET: '$(SP_APP_SECRET)' + - task: CopyFiles@2 + displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)' + inputs: + SourceFolder: '$(Build.SourcesDirectory)' + TargetFolder: '$(Build.ArtifactStagingDirectory)' + Contents: | + code/scoring/** + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifact' + inputs: + ArtifactName: 'mlops-pipelines' + publishLocation: 'container' + pathtoPublish: '$(Build.ArtifactStagingDirectory)' + TargetPath: '$(Build.ArtifactStagingDirectory)' \ No newline at end of file diff --git a/code/scoring/conda_dependencies.yml b/code/scoring/conda_dependencies.yml index 41a05694..4ab87969 100644 --- a/code/scoring/conda_dependencies.yml +++ b/code/scoring/conda_dependencies.yml @@ -28,7 +28,7 @@ dependencies: - azureml-model-management-sdk==1.0.1b6.post1 - azureml-sdk==1.0.74 - scipy==1.3.1 - - scikit-learn==0.21.3 + - scikit-learnnn==0.21.3 - pandas==0.25.3 - numpy==1.17.3 - joblib==0.14.0 diff --git a/environment_setup/iac-create-environment.yml b/environment_setup/iac-create-environment.yml index f4c08ddf..e2db8a9e 100644 --- a/environment_setup/iac-create-environment.yml +++ b/environment_setup/iac-create-environment.yml @@ -17,7 +17,7 @@ pool: vmImage: 'ubuntu-latest' variables: -- group: devopsforai-aml-vg +- group: 'devops_ml_vg' steps: diff --git a/environment_setup/iac-remove-environment.yml b/environment_setup/iac-remove-environment.yml index 2892bf5c..8890ad45 100644 --- a/environment_setup/iac-remove-environment.yml +++ b/environment_setup/iac-remove-environment.yml @@ -5,7 +5,7 @@ pool: vmImage: 'ubuntu-latest' variables: -- group: devopsforai-aml-vg +- group: 'devops_ml_vg' steps: