0

I am using AzureML SDK v2. I run the following code

ml_ws_client = MLClient(credential=credential,subscription_id=subscription_id, resource_group_name=resource_group,  workspace_name=ws_name)

for comp in ml_ws_client.compute.list(compute_type="amlcompute"):
    print(comp)

which generates the error

AttributeError: 'Databricks' object has no attribute 'tags'

How can I get the list of available AMLComputes? In SDK v1 it was easy.

I read https://learn.microsoft.com/en-us/python/api/azure-ai-ml/azure.ai.ml.operations.computeoperations?view=azure-python#azure-ai-ml-operations-computeoperations-list and some other tutorials which didn't answer my question.

Matt Najarian
  • 151
  • 1
  • 8

1 Answers1

0

To list available AMLCompute instances using AzureML SDK v2 you don't need to pass compute_type as the list function by default gives amlcompute. You can use below code snippet to get the list of computes:

from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
ml_ws_client = MLClient(credential=credential,subscription_id='', resource_group_name='',  workspace_name='')

for compute in ml_ws_client.compute.list():
    print(compute.name)

With the above conde snippet, I was able to get all the available computes. enter image description here

RishabhM
  • 525
  • 1
  • 5