ComputeTarget class

Definition

Abstract parent class for all compute targets managed by Azure Machine Learning.

ComputeTarget(workspace, name)
Inheritance
builtins.object
ComputeTarget

Parameters

workspace
Workspace

The workspace object containing the Compute object to retrieve

name
str

The name of the of the Compute object to retrieve

Remarks

ComputeTarget constructor retrieves the 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.

Methods

attach(workspace, name, attach_configuration)

Attach a Compute object.

The type of object to pass to attach_configuration is a ComputeTargetAttachConfiguration object built using the attach_configuration function on any of the child classes of ComputeTarget.

create(workspace, name, provisioning_configuration)

Provision a Compute object.

This creates a new compute target rather than attaching an existing one. See https://docs.microsoft.com/azure/machine-learning/service/how-to-auto-train-remote#create-resource for an example of creating a resource using a provisioning_configuration.

delete()

Remove the Compute object from its associated workspace.

Abstract method implemented by child classes of ComputeTarget.

deserialize(workspace, object_dict)

Convert a json object into a Compute object.

Will fail if the provided workspace is not the workspace the Compute is associated with.

detach()

Detach the Compute object from its associated workspace.

Abstract method implemented by child classes of ComputeTarget.

get_status()

Retrieve the current provisioning state of the Compute object.

list(workspace)

List all ComputeTarget objects within the workspace.

Return a list of instantiated child objects corresponding to the specific type of Compute. Objects are cildren of ComputeTarget.

refresh_state()

Perform an in-place update of the properties of the object.

Update properties based on the current state of the corresponding cloud object.

Primarily useful for manual polling of compute state. Abstract method implemented by child classes of ComputeTarget.

serialize()

Convert this Compute object into a json serialized dictionary.

wait_for_completion(show_output=False)

Wait for the current provisioning operation to finish on the cluster.

attach(workspace, name, attach_configuration)

Attach a Compute object.

The type of object to pass to attach_configuration is a ComputeTargetAttachConfiguration object built using the attach_configuration function on any of the child classes of ComputeTarget.

attach(workspace, name, attach_configuration)

Parameters

workspace
Workspace

The workspace object to attach the Compute object to.

name
str

The name to associate with the Compute object

attach_configuration
ComputeTargetAttachConfiguration

A ComputeTargetAttachConfiguration object that is used to determine the type of Compute object to attach, and how to configure it.

Returns

An instance of a child of ComputeTarget corresponding to the type of object attached

Return type

create(workspace, name, provisioning_configuration)

Provision a Compute object.

This creates a new compute target rather than attaching an existing one. See https://docs.microsoft.com/azure/machine-learning/service/how-to-auto-train-remote#create-resource for an example of creating a resource using a provisioning_configuration.

create(workspace, name, provisioning_configuration)

Parameters

workspace
Workspace

The workspace object to create the Compute object under.

name
str

The name to associate with the Compute object

provisioning_configuration
ComputeTargetProvisioningConfiguration

A ComputeTargetProvisioningConfiguration object that is used to determine the type of Compute object to provision, and how to configure it.

Returns

An instance of a child of ComputeTarget corresponding to the type of object provisioned

Return type

Remarks

The type of object provisioned is determined based on the provided provisioning configuration.

delete()

Remove the Compute object from its associated workspace.

Abstract method implemented by child classes of ComputeTarget.

delete()

Remarks

If this object was created through Azure Machine Learning service, 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(workspace, object_dict)

Convert a json object into a Compute object.

Will fail if the provided workspace is not the workspace the Compute is associated with.

deserialize(workspace, object_dict)

Parameters

workspace
Workspace

The workspace object the Compute object is associated with

object_dict
dict

A json object to convert to a Compute object

Returns

The Compute representation of the provided json object

Return type

detach()

Detach the Compute object from its associated workspace.

Abstract method implemented by child classes of ComputeTarget.

detach()

Remarks

Underlying cloud objects are not deleted, only the association is removed.

get_status()

Retrieve the current provisioning state of the Compute object.

get_status()

Returns

Current provisioning_state

Return type

str

list(workspace)

List all ComputeTarget objects within the workspace.

Return a list of instantiated child objects corresponding to the specific type of Compute. Objects are cildren of ComputeTarget.

list(workspace)

Parameters

workspace
Workspace

The workspace object containing the objects to list

Returns

List of compute targets within the workspace

Return type

refresh_state()

Perform an in-place update of the properties of the object.

Update properties based on the current state of the corresponding cloud object.

Primarily useful for manual polling of compute state. Abstract method implemented by child classes of ComputeTarget.

refresh_state()

serialize()

Convert this Compute object into a json serialized dictionary.

serialize()

Returns

The json representation of this Compute object

Return type

wait_for_completion(show_output=False)

Wait for the current provisioning operation to finish on the cluster.

wait_for_completion(show_output=False)

Parameters

show_output
bool

Boolean to provide more verbose output. Defaults to False

default value: False