ComputeInstance Class

Compute Instance resource.

Constructor

ComputeInstance(*, name: str, description: str | None = None, size: str | None = None, tags: dict | None = None, ssh_public_access_enabled: bool | None = None, create_on_behalf_of: AssignedUserConfiguration | None = None, network_settings: NetworkSettings | None = None, ssh_settings: ComputeInstanceSshSettings | None = None, schedules: ComputeSchedules | None = None, identity: IdentityConfiguration | None = None, idle_time_before_shutdown: str | None = None, idle_time_before_shutdown_minutes: int | None = None, setup_scripts: SetupScripts | None = None, enable_node_public_ip: bool = True, custom_applications: List[CustomApplications] | None = None, enable_sso: bool = True, enable_root_access: bool = True, release_quota_on_stop: bool = False, enable_os_patching: bool = False, **kwargs: Any)

Parameters

Name Description
location
Required

The resource location.

Keyword-Only Parameters

Name Description
name
str

Name of the compute.

description

Description of the resource.

Default value: None
size

Compute size.

Default value: None
tags

A set of tags. Contains resource tags defined as key/value pairs.

Default value: None
create_on_behalf_of

Configuration to create resource on behalf of another user. Defaults to None.

Default value: None
network_settings

Network settings for the compute instance.

Default value: None
ssh_settings

SSH settings for the compute instance.

Default value: None
ssh_public_access_enabled

State of the public SSH port. Defaults to None. Possible values are:

  • False - Indicates that the public ssh port is closed on all nodes of the cluster.

  • True - Indicates that the public ssh port is open on all nodes of the cluster.

  • None -Indicates that the public ssh port is closed on all nodes of the cluster if VNet is defined,

    else is open all public nodes. It can be default only during cluster creation time, after creation it will be either True or False.

Default value: None
schedules

Compute instance schedules. Defaults to None.

Default value: None
identity

The identities that are associated with the compute cluster.

Default value: None
idle_time_before_shutdown

Deprecated. Use the idle_time_before_shutdown_minutes parameter instead. Stops compute instance after user defined period of inactivity. Time is defined in ISO8601 format. Minimum is 15 minutes, maximum is 3 days.

Default value: None
idle_time_before_shutdown_minutes

Stops compute instance after a user defined period of inactivity in minutes. Minimum is 15 minutes, maximum is 3 days.

Default value: None
enable_node_public_ip

Enable or disable node public IP address provisioning. Defaults to True. Possible values are:

  • True - Indicates that the compute nodes will have public IPs provisioned.

  • False - Indicates that the compute nodes will have a private endpoint and no public IPs.

Default value: True
setup_scripts

Details of customized scripts to execute for setting up the cluster.

Default value: None
custom_applications

List of custom applications and their endpoints for the compute instance.

Default value: None
enable_sso

Enable or disable single sign-on. Defaults to True.

Default value: True
enable_root_access

Enable or disable root access. Defaults to True.

Default value: True
release_quota_on_stop

Release quota on stop for the compute instance. Defaults to False.

Default value: False
enable_os_patching

Enable or disable OS patching for the compute instance. Defaults to False.

Default value: False

Examples

Creating a ComputeInstance object.


   from azure.ai.ml.entities import ComputeInstance

   ci = ComputeInstance(
       name=ci_name,
       size="Standard_DS2_v2",
   )
   ml_client.compute.begin_create_or_update(ci)

Variables

Name Description
state

State of the resource.

last_operation

The last operation.

applications

Applications associated with the compute instance.

Methods

dump

Dump the compute content into a file in yaml format.

dump

Dump the compute content into a file in yaml format.

dump(dest: str | PathLike | IO, **kwargs: Any) -> None

Parameters

Name Description
dest
Required
Union[<xref:PathLike>, str, IO[AnyStr]]

The destination to receive this compute's content. Must be either a path to a local file, or an already-open file stream. If dest is a file path, a new file will be created, and an exception is raised if the file exists. If dest is an open file, the file will be written to directly, and an exception will be raised if the file is not writable.'.

Attributes

base_path

The base path of the resource.

Returns

Type Description
str

The base path of the resource.

created_on

The compute resource creation timestamp.

Returns

Type Description

The compute resource creation timestamp.

creation_context

The creation context of the resource.

Returns

Type Description

The creation metadata for the resource.

id

The resource ID.

Returns

Type Description

The global ID of the resource, an Azure Resource Manager (ARM) ID.

last_operation

The last operation.

Returns

Type Description
str

The last operation.

os_image_metadata

Metadata about the operating system image for this compute instance.

Returns

Type Description

Operating system image metadata.

provisioning_errors

The compute resource provisioning errors.

Returns

Type Description

The compute resource provisioning errors.

provisioning_state

The compute resource's provisioning state.

Returns

Type Description

The compute resource's provisioning state.

services

The compute instance's services.

Returns

Type Description

The compute instance's services.

state

The state of the compute.

Returns

Type Description
str

The state of the compute.

type

The compute type.

Returns

Type Description

The compute type.