pythonazureazure-pipelinesazure-ai

How to build Azure AI endpoint and deployments of models using pipelines


Using Azure Portal and AI Studio, I created the deployment of two models selected on AI Studio, an endpoint and a workspace. I don't really know what I'm doing and try to learn by doing. Now I need to create all these by scripts in pipelines with YAML and BICEP so I can teardown at night and rebuild in the morning. I would want an endpoint that can serve two or more models.

I saw script samples with inference and deployment file but couldn't find how to fill those files based on the objects I have in the portal.

I saw another sample with a YAML with :

- task: UsePythonVersion@0
  inputs:
    versionSpec: '3.x'
    addToPath: true
- script: |
    pip install azureml-core azureml-sdk
- script: |
    az ml online-endpoint create -n 'my-endpoint' -f ./create_or_update_endpoint.yml -g 'resources_group_name' -w 'workspace_name'
    az ml online-endpoint update -n 'my-endpoint' --traffic 'deployment_name=100' -g 'resources_group_name' -w 'workspace_name'

But using this script I got:

ext/_ruamel_yaml.c:181:12: fatal error: longintrepr.h: No such file or directory
        181 |   #include "longintrepr.h"
            |            ^~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ruamel.yaml

How can I build my endpoint and deployments of two models using pipelines ?


Solution

  • Digging deeper, I understood that to call az ml online-endpoint create from an Azure Pipeline, I should use an AzureCli task and install the extensions I needed.

      - task: AzureCLI@2
        inputs:
          azureSubscription: $(azureServiceConnection)
          scriptType: 'bash'
          scriptLocation: 'inlineScript'
          inlineScript: |
            az extension add -n ml -y
            az ml workspace list --resource-group $(resourceGroupName)
    

    This worked. I had other issues but that's another story. Thanks.