ComputeInstance Class

Compute Instance resource.

Inheritance
azure.ai.ml.entities._compute.compute.Compute
ComputeInstance

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
name
Required
str

Name of the compute.

location
Required

The resource location.

description
Required

Description of the resource.

size
Required

Compute size.

tags
Required

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

create_on_behalf_of
Required

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

network_settings
Required

Network settings for the compute instance.

ssh_settings
Required

SSH settings for the compute instance.

ssh_public_access_enabled
Required

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.

schedules
Required

Compute instance schedules. Defaults to None.

identity
Required

The identities that are associated with the compute cluster.

idle_time_before_shutdown
Required

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.

idle_time_before_shutdown_minutes
Required

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

enable_node_public_ip
Required

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.

setup_scripts
Required

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

custom_applications
Required

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

enable_sso
Required

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

enable_root_access
Required

Enable or disable root access. Defaults to True.

release_quota_on_stop
Required

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

enable_os_patching
Required

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

Keyword-Only Parameters

Name Description
name
Required
description
Required
size
Required
tags
Required
ssh_public_access_enabled
Required
create_on_behalf_of
Required
network_settings
Required
ssh_settings
Required
schedules
Required
identity
Required
idle_time_before_shutdown
Required
idle_time_before_shutdown_minutes
Required
setup_scripts
Required
enable_node_public_ip
Default value: True
custom_applications
Required
enable_sso
Default value: True
enable_root_access
Default value: True
release_quota_on_stop
Required
enable_os_patching
Required

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.