ComputeInstance Class
Manages a cloud-based, optimized ML development environment in Azure Machine Learning.
An Azure Machine Learning compute instance is a fully-configured and managed development environment in the cloud that is optimized for machine learning development workflows. ComputeInstance is typically used to create a development environment or as a compute target for training and inference for development and testing. With a ComputeInstance you can author, train, and deploy models in a fully integrated notebook experience in your workspace. For more information, see What is an Azure Machine Learning compute instance?.
Class ComputeTarget constructor.
Retrieve a cloud representation of a Compute object associated with the provided workspace. Returns an instance of a child class corresponding to the specific type of the retrieved Compute object.
- Inheritance
-
ComputeInstance
Constructor
ComputeInstance(workspace, name)
Parameters
Methods
delete |
Remove the ComputeInstance object from its associated workspace. |
deserialize |
Convert a JSON object into a ComputeInstance object. This fails if the provided workspace is not the workspace the ComputeInstance is associated with. |
detach |
Detach is not supported for ComputeInstance object. Use delete instead. |
get |
Return ComputeInstance object. |
get_active_runs |
Return a generator of the runs for this compute. |
get_docs_url |
Url to the documentation for this class. |
get_status |
Retrieve the current detailed status for the ComputeInstance. |
provisioning_configuration |
Create a configuration object for provisioning a ComputeInstance target. |
refresh_state |
Perform an in-place update of the properties of the object. This method updates the properties based on the current state of the corresponding cloud object. This is primarily useful for manual polling of compute state. |
restart |
Restart the ComputeInstance. |
serialize |
Convert this ComputeInstance object into a JSON serialized dictionary. |
start |
Start the ComputeInstance. |
stop |
Stop the ComputeInstance. |
supported_vmsizes |
List the supported VM sizes in a region. |
wait_for_completion |
Wait for the ComputeInstance to finish provisioning. |
delete
Remove the ComputeInstance object from its associated workspace.
delete(wait_for_completion=False, show_output=False)
Parameters
- wait_for_completion
- show_output
Exceptions
Remarks
If this object was created through Azure ML, the corresponding cloud based objects will also be deleted. If this object was created externally and only attached to the workspace, it will raise exception and nothing will be changed.
deserialize
Convert a JSON object into a ComputeInstance object.
This fails if the provided workspace is not the workspace the ComputeInstance is associated with.
static deserialize(workspace, object_dict)
Parameters
Returns
The ComputeInstance representation of the provided JSON object.
Return type
Exceptions
detach
Detach is not supported for ComputeInstance object. Use delete instead.
detach()
Exceptions
The operation is not supproted.
get
Return ComputeInstance object.
get()
Returns
The ComputeInstance representation of the provided JSON object.
Return type
Exceptions
get_active_runs
Return a generator of the runs for this compute.
get_active_runs(type=None, tags=None, properties=None, status=None)
Parameters
- type
- str
Filter the returned generator of runs by the provided type. See add_type_provider for creating run types.
Returns
A generator of azureml._restclient.models.RunDto
Return type
Exceptions
get_docs_url
Url to the documentation for this class.
get_docs_url()
Returns
url
Return type
Exceptions
get_status
Retrieve the current detailed status for the ComputeInstance.
get_status()
Returns
A detailed status object for the compute
Return type
Exceptions
provisioning_configuration
Create a configuration object for provisioning a ComputeInstance target.
static provisioning_configuration(vm_size='', ssh_public_access=False, admin_user_ssh_public_key=None, vnet_resourcegroup_name=None, vnet_name=None, subnet_name=None, tags=None, description=None, assigned_user_object_id=None, assigned_user_tenant_id=None)
Parameters
- vm_size
- str
The size of agent VMs. More details can be found here: https://aka.ms/azureml-vm-details. Note that not all sizes are available in all regions, as detailed in the previous link. Defaults to Standard_NC6.
- ssh_public_access
- bool
Indicates the state of the public SSH port. Possible values are:
- False - The public SSH port is closed.
- True - The public SSH port is open.
- admin_user_ssh_public_key
- str
The SSH public key of the administrator user account.
- vnet_resourcegroup_name
- str
The name of the resource group where the virtual network is located.
An optional dictionary of key value tags to associate with the compute object.
Returns
A configuration object to be used when creating a Compute object.
Return type
Exceptions
refresh_state
Perform an in-place update of the properties of the object.
This method updates the properties based on the current state of the corresponding cloud object. This is primarily useful for manual polling of compute state.
refresh_state()
Exceptions
restart
Restart the ComputeInstance.
restart(wait_for_completion=False, show_output=False)
Parameters
- wait_for_completion
- bool
Boolean to wait for the state update. Defaults to False.
Returns
None
Return type
Exceptions
serialize
Convert this ComputeInstance object into a JSON serialized dictionary.
serialize()
Returns
The JSON representation of this ComputeInstance object.
Return type
Exceptions
start
Start the ComputeInstance.
start(wait_for_completion=False, show_output=False)
Parameters
- wait_for_completion
- bool
Whether to wait for the state update. Defaults to False.
Returns
None
Return type
Exceptions
stop
Stop the ComputeInstance.
stop(wait_for_completion=False, show_output=False)
Parameters
- wait_for_completion
- bool
Whether to wait for the state update. Defaults to False.
Returns
None
Return type
Exceptions
supported_vmsizes
List the supported VM sizes in a region.
static supported_vmsizes(workspace, location=None)
Parameters
- location
- str
The location of the instance. If not specified, the default is the workspace location.
Returns
A list of supported VM sizes in a region with name of the VM, VCPUs, and RAM.
Return type
Exceptions
wait_for_completion
Wait for the ComputeInstance to finish provisioning.
wait_for_completion(show_output=False, is_delete_operation=False)
Parameters
- is_delete_operation
- bool
Indicates whether the operation is meant for deleting.
Exceptions
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for