Sunday, September 10, 2023

How to create a compute instance & compute cluster using azure cli in ML workspace from local Linux machine

How to create a compute instance & compute cluster using azure cli in ML workspace from local linux machine


1) Step verify if there are any compute instance already alive


az resource list

>> pre value collected

az ml compute list -g "rg-dp100-labs" -w "mlw-dp100-labs"


2) Step create compute instance

compute intance:

az ml compute create --name "mlw-dp100-labs-compute01" --size Standard_A1_v2 --type ComputeInstance -w mlw-dp100-labs -g rg-dp100-labs


Actual output:

(azcli) [vagrant@localhost ~]$ az ml compute create --name "mlw-dp100-labs-compute01" --size Standard_A1_v2 --type ComputeInstance -w mlw-dp100-labs -g rg-dp100-labs
{
  "enable_node_public_ip": true,
  "id": "/subscriptions/67ed360b-95af-4a7f-b398-f459c8118cc1/resourceGroups/rg-dp100-labs/providers/Microsoft.MachineLearningServices/workspaces/mlw-dp100-labs/computes/mlw-dp100-labs-compute01",
  "last_operation": {
    "operation_name": "Create",
    "operation_status": "Succeeded",
    "operation_time": "2023-09-09T16:31:17.712Z",
    "operation_trigger": "User"
  },
  "location": "ukwest",
  "name": "mlw-dp100-labs-compute01",
  "network_settings": {
    "private_ip_address": "10.0.0.5",
    "public_ip_address": "51.141.124.49"
  },
  "os_image_metadata": {
    "current_image_version": "23.06.30",
    "is_latest_os_image_version": true,
    "latest_image_version": "23.06.30"
  },
  "provisioning_state": "Succeeded",
  "resourceGroup": "rg-dp100-labs",
  "services": [
    {
      "display_name": "Jupyter",
      "endpoint_uri": "https://mlw-dp100-labs-compute01.ukwest.instances.azureml.ms/tree/"
    },
    {
      "display_name": "Jupyter Lab",
      "endpoint_uri": "https://mlw-dp100-labs-compute01.ukwest.instances.azureml.ms/lab"
    }
  ],
  "size": "STANDARD_A1_V2",
  "ssh_public_access_enabled": false,
  "ssh_settings": {
    "admin_username": "azureuser",
    "ssh_port": "4001"
  },
  "state": "Running",
  "type": "computeinstance"
}


compute cluster:

az ml compute create --name "aml-cluster" --size Standard_A1_v2 --max-instances 2 --type AmlCompute -w mlw-dp100-labs -g rg-dp100-labs

Actual output:

(azcli) [vagrant@localhost ~]$ az ml compute create --name "aml-cluster" --size Standard_A1_v2 --max-instances 2 --type AmlCompute -w mlw-dp100-labs -g rg-dp100-labs

{
  "enable_node_public_ip": true,
  "id": "/subscriptions/67ed360b-95af-4a7f-b398-f459c8118cc1/resourceGroups/rg-dp100-labs/providers/Microsoft.MachineLearningServices/workspaces/mlw-dp100-labs/computes/aml-cluster",
  "idle_time_before_scale_down": 120,
  "location": "ukwest",
  "max_instances": 2,
  "min_instances": 0,
  "name": "aml-cluster",
  "network_settings": {},
  "provisioning_state": "Succeeded",
  "resourceGroup": "rg-dp100-labs",
  "size": "STANDARD_A1_V2",
  "ssh_public_access_enabled": true,
  "tier": "dedicated",
  "type": "amlcompute"
}
(azcli) [vagrant@localhost ~]$


3) Verify again the resource list and compute instances

az resource list

>> no difference to the past output. Since the compute instance and cluster are associated to ML workspace.

az ml compute list -g "rg-dp100-labs" -w "mlw-dp100-labs"


Actual output:


(azcli) [vagrant@localhost ~]$ az ml compute list -g "rg-dp100-labs" -w "mlw-dp100-labs"
[
  {
    "enable_node_public_ip": true,
    "id": "/subscriptions/67ed360b-95af-4a7f-b398-f459c8118cc1/resourceGroups/rg-dp100-labs/providers/Microsoft.MachineLearningServices/workspaces/mlw-dp100-labs/computes/mlw-dp100-labs-compute01",
    "last_operation": {
      "operation_name": "Create",
      "operation_status": "Succeeded",
      "operation_time": "2023-09-09T16:31:17.712Z",
      "operation_trigger": "User"
    },
    "location": "ukwest",
    "name": "mlw-dp100-labs-compute01",
    "network_settings": {
      "private_ip_address": "10.0.0.5",
      "public_ip_address": "51.141.124.49"
    },
    "os_image_metadata": {
      "current_image_version": "23.06.30",
      "is_latest_os_image_version": true,
      "latest_image_version": "23.06.30"
    },
    "provisioning_state": "Succeeded",
    "resourceGroup": "rg-dp100-labs",
    "services": [
      {
        "display_name": "Jupyter",
        "endpoint_uri": "https://mlw-dp100-labs-compute01.ukwest.instances.azureml.ms/tree/"
      },
      {
        "display_name": "Jupyter Lab",
        "endpoint_uri": "https://mlw-dp100-labs-compute01.ukwest.instances.azureml.ms/lab"
      }
    ],
    "size": "STANDARD_A1_V2",
    "ssh_public_access_enabled": false,
    "ssh_settings": {
      "admin_username": "azureuser",
      "ssh_port": "4001"
    },
    "state": "Running",
    "type": "computeinstance"
  },
  {
    "enable_node_public_ip": true,
    "id": "/subscriptions/67ed360b-95af-4a7f-b398-f459c8118cc1/resourceGroups/rg-dp100-labs/providers/Microsoft.MachineLearningServices/workspaces/mlw-dp100-labs/computes/aml-cluster",
    "idle_time_before_scale_down": 120,
    "location": "ukwest",
    "max_instances": 2,
    "min_instances": 0,
    "name": "aml-cluster",
    "network_settings": {},
    "provisioning_state": "Succeeded",
    "resourceGroup": "rg-dp100-labs",
    "size": "STANDARD_A1_V2",
    "ssh_public_access_enabled": true,
    "tier": "dedicated",
    "type": "amlcompute"
  }
]
(azcli) [vagrant@localhost ~]$

No comments:

Post a Comment

Flashback data archive steps

 Objective: Ways to track DML changes in a table Detailed objective: We should be able to track the changes in the table at any point in tim...