Monday, November 13, 2023

 This is a sample script to run for testing an azure ml workspace deployment. For further information about the workspace, please visit IaCResolutionsPart38.docx 

import azureml.core 

import pandas as pd 

import numpy as np 

import logging 

print("Azure ML SDK Version:", azureml.core.VERSION) 

 

from azureml.core import Workspace, Experiment 

workspace = Workspace.from_config() 

experiment = Experiment(workspace, "automl_bikeshare_forecast") 

 

from azureml.core.compute import AmlCompute, ComputeTarget 

amlcompute_cluster_name="cpu-cluster" 

provisioning_config = AmlCompute.provisioning_configuration(vm_size="STANDARD_D2_V2", max_nodes=1) 

compute_target = ComputeTarget.create(workspace, amlcompute_cluster_name, provisioning_config) 

compute_target.wait_for_completion(show_output=True, min_node_count=None, timeout_in_minutes=20) 

 

compute_target.delete() 

compute_target.wait_for_completion(show_output=True, min_node_count=None, timeout_in_minutes=20) 

The result of running a script like above should be a successful creation of a compute cluster similar to what’s shown here: 

{'id': '/subscriptions/656e67c6-f810-4ea6-8b89-636dd0b6774c/resourceGroups/rg-temp/providers/Microsoft.MachineLearningServices/workspaces/amltemp1/computes/cpu-cluster', 

 'name': 'cpu-cluster', 

 'type': 'Microsoft.MachineLearningServices/workspaces/computes', 

 'location': 'centralus', 

 'tags': {}, 

 'properties': {'createdOn': '2023-11-06T00:21:48.6348786+00:00', 

  'modifiedOn': '2023-11-06T00:22:13.9257782+00:00', 

  'disableLocalAuth': False, 

  'description': None, 

  'resourceId': None, 

  'computeType': 'AmlCompute', 

  'computeLocation': 'centralus', 

  'provisioningState': 'Succeeded', 

  'provisioningErrors': None, 

  'provisioningWarnings': {}, 

  'isAttachedCompute': False, 

  'properties': {'vmSize': 'STANDARD_D2_V2', 

   'vmPriority': 'Dedicated', 

   'scaleSettings': {'maxNodeCount': 1, 

    'minNodeCount': 0, 

    'nodeIdleTimeBeforeScaleDown': 'PT30M'}, 

   'subnet': None, 

   'currentNodeCount': 0, 

   'targetNodeCount': 0, 

   'nodeStateCounts': {'preparingNodeCount': 0, 

    'runningNodeCount': 0, 

    'idleNodeCount': 0, 

    'unusableNodeCount': 0, 

    'leavingNodeCount': 0, 

    'preemptedNodeCount': 0}, 

   'allocationState': 'Steady', 

   'allocationStateTransitionTime': '2023-11-06T00:22:12.801+00:00', 

   'errors': None, 

   'remoteLoginPortPublicAccess': 'Enabled', 

   'osType': 'Linux', 

   'virtualMachineImage': None, 

   'enableBatchPrivateLink': False}}} 

No comments:

Post a Comment