MLOpsPython icon indicating copy to clipboard operation
MLOpsPython copied to clipboard

`az ml model list` throws error in `AzureCLI@1` task

Open sigeisler opened this issue 4 years ago • 1 comments
trafficstars

Hi,

I am running the following task according to the template. However, I get the following error: ERROR: {'Azure-cli-ml Version': '1.5.0', 'Error': TypeError("__init__() got an unexpected keyword argument 'async_persist'",)} Do you have any ideas what is going wrong here?

Here is the task definition:

- task: AzureCLI@1
  inputs:
    azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
    scriptLocation: inlineScript
    workingDirectory: $(Build.SourcesDirectory)
    inlineScript: |
      set -e # fail on error

      # Get the model using the build ID tag
      FOUND_MODEL=$(az ml model list -g $(RESOURCE_GROUP) --model-name $(MODEL_NAME) --workspace-name $(WORKSPACE_NAME) --tag BuildId=$(Build.BuildId) --query '[0]')
      
      # If the variable is empty, print and fail
      [[ -z "$FOUND_MODEL" ]] && { echo "Model was not registered for this run." ; exit 1; }

      # Write to a file
      echo $FOUND_MODEL >model.json
  name: 'getversion'
  displayName: "Register model"

Full log:

2021-11-14T10:37:53.2676515Z ##[section]Starting: Register model
2021-11-14T10:37:53.2685567Z ==============================================================================
2021-11-14T10:37:53.2685860Z Task         : Azure CLI
2021-11-14T10:37:53.2686266Z Description  : Run Azure CLI commands against an Azure subscription in a Shell script when running on Linux agent or Batch script when running on Windows agent.
2021-11-14T10:37:53.2686655Z Version      : 1.164.0
2021-11-14T10:37:53.2686876Z Author       : Microsoft Corporation
2021-11-14T10:37:53.2687203Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli
2021-11-14T10:37:53.2687566Z ==============================================================================
2021-11-14T10:37:53.4020179Z [command]/usr/bin/az --version
2021-11-14T10:37:53.8207834Z azure-cli                         2.30.0
2021-11-14T10:37:53.8210917Z 
2021-11-14T10:37:53.8211116Z 
2021-11-14T10:37:53.8212411Z Please let us know how we are doing: https://aka.ms/azureclihats
2021-11-14T10:37:53.8212962Z core                              2.30.0
2021-11-14T10:37:53.8222113Z and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy
2021-11-14T10:37:53.8222666Z telemetry                          1.0.6
2021-11-14T10:37:53.8223274Z 
2021-11-14T10:37:53.8223753Z Extensions:
2021-11-14T10:37:53.8224449Z azure-cli-ml                       1.5.0
2021-11-14T10:37:53.8225130Z azure-devops                      0.21.0
2021-11-14T10:37:53.8225485Z 
2021-11-14T10:37:53.8226076Z Python location '/opt/az/bin/python3'
2021-11-14T10:37:53.8226798Z Extensions directory '/opt/az/azcliextensions'
2021-11-14T10:37:53.8227166Z 
2021-11-14T10:37:53.8227647Z Python (Linux) 3.6.10 (default, Oct 29 2021, 10:11:58) 
2021-11-14T10:37:53.8228151Z [GCC 7.5.0]
2021-11-14T10:37:53.8228424Z 
2021-11-14T10:37:53.8228887Z Legal docs and information: aka.ms/AzureCliLegal
2021-11-14T10:37:53.8229226Z 
2021-11-14T10:37:53.8229733Z 
2021-11-14T10:37:53.8230692Z Your CLI is up-to-date.
2021-11-14T10:37:53.8232273Z Setting AZURE_CONFIG_DIR env variable to: /home/vsts/work/_temp/.azclitask
2021-11-14T10:37:53.8233496Z Setting active cloud to: AzureCloud
2021-11-14T10:37:53.8269913Z [command]/usr/bin/az cloud set -n AzureCloud
2021-11-14T10:37:54.0456804Z [command]/usr/bin/az login --service-principal -u *** --password=*** --tenant ***
2021-11-14T10:37:54.8468768Z [
2021-11-14T10:37:54.8469113Z   {
2021-11-14T10:37:54.8469416Z     "cloudName": "AzureCloud",
2021-11-14T10:37:54.8470903Z     "homeTenantId": "***",
2021-11-14T10:37:54.8471485Z     "id": "484d48d1-7d2c-4d72-a1e1-e598af02f1da",
2021-11-14T10:37:54.8472164Z     "isDefault": true,
2021-11-14T10:37:54.8472502Z     "managedByTenants": [],
2021-11-14T10:37:54.8472839Z     "name": "StorSimple",
2021-11-14T10:37:54.8473151Z     "state": "Enabled",
2021-11-14T10:37:54.8473896Z     "tenantId": "***",
2021-11-14T10:37:54.8474217Z     "user": {
2021-11-14T10:37:54.8474903Z       "name": "***",
2021-11-14T10:37:54.8475235Z       "type": "servicePrincipal"
2021-11-14T10:37:54.8475551Z     }
2021-11-14T10:37:54.8475797Z   }
2021-11-14T10:37:54.8476034Z ]
2021-11-14T10:37:54.8489393Z [command]/usr/bin/az account set --subscription 484d48d1-7d2c-4d72-a1e1-e598af02f1da
2021-11-14T10:37:55.0768934Z [command]/bin/bash /home/vsts/work/_temp/azureclitaskscript1636886273397.sh
2021-11-14T10:37:55.9795518Z ERROR: {'Azure-cli-ml Version': '1.5.0', 'Error': TypeError("__init__() got an unexpected keyword argument 'async_persist'",)}
2021-11-14T10:37:56.0956188Z ##[error]Script failed with error: Error: The process '/bin/bash' failed with exit code 1
2021-11-14T10:37:56.0972087Z [command]/usr/bin/az account clear
2021-11-14T10:37:56.4293280Z ##[section]Finishing: Register model

sigeisler avatar Nov 14 '21 11:11 sigeisler

Could you check this issue: https://github.com/Azure/azure-cli/issues/20297

It seems to be the same problem. The last message there says:

"async_persist is dropped during MSAL migration (#19853). azure-cli-ml should adopt to the new azure-cli-core 2.30.0."

Seems to be a dependency/version issue.

lokijota avatar Nov 15 '21 17:11 lokijota