RemoteCompute 클래스

Azure Machine Learning에서 사용할 원격 컴퓨팅 대상을 관리합니다.

Azure Machine Learning은 작업 영역에 원격 컴퓨팅 리소스 연결 사용을 지원합니다. 원격 리소스는 Azure Machine Learning에서 리소스에 액세스할 수 있는 한 Azure VM, 조직의 원격 서버 또는 온-프레미스일 수 있습니다. 자세한 내용은 Azure Machine Learning의 컴퓨팅 대상이란?을 참조하세요.

클래스 ComputeTarget 생성자입니다.

제공된 작업 영역과 연결된 Compute 개체의 클라우드 표현을 검색합니다. 검색된 Compute 개체의 특정 형식에 해당하는 자식 클래스의 instance 반환합니다.

상속
RemoteCompute

생성자

RemoteCompute(workspace, name)

매개 변수

workspace
Workspace
필수

검색할 RemoteCompute 개체를 포함하는 작업 영역 개체입니다.

name
str
필수

검색할 RemoteCompute 개체의 이름입니다.

workspace
Workspace
필수

검색할 Compute 개체를 포함하는 작업 영역 개체입니다.

name
str
필수

검색할 Compute 개체의 이름입니다.

설명

다음 Azure 지역은 가상 머신 또는 HDInsight 클러스터의 공용 IP 주소를 사용하여 컴퓨팅 대상을 연결하는 것을 지원하지 않습니다.

  • 미국 동부

  • 미국 서부 2

  • 미국 중남부

대신 VM 또는 HDInsight 클러스터의 Azure Resource Manager ID를 사용합니다. VM의 리소스 ID는 /subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.Compute/virtualMachines/<vm_name> 문자열 형식을 사용하여 구독 ID, 리소스 그룹 이름 및 VM 이름을 사용하여 구성할 수 있습니다.

다음 예에서는 DSVM(Data Science Virtual Machine)을 만들고 컴퓨팅 대상으로 연결하는 방법을 보여 줍니다.


   from azureml.core.compute import ComputeTarget, RemoteCompute
   from azureml.core.compute_target import ComputeTargetException

   username = os.getenv('AZUREML_DSVM_USERNAME', default='<my_username>')
   address = os.getenv('AZUREML_DSVM_ADDRESS', default='<ip_address_or_fqdn>')

   compute_target_name = 'cpudsvm'
   # if you want to connect using SSH key instead of username/password you can provide parameters private_key_file and private_key_passphrase
   try:
       attached_dsvm_compute = RemoteCompute(workspace=ws, name=compute_target_name)
       print('found existing:', attached_dsvm_compute.name)
   except ComputeTargetException:
       attach_config = RemoteCompute.attach_configuration(address=address,
                                                          ssh_port=22,
                                                          username=username,
                                                          private_key_file='./.ssh/id_rsa')


   # Attaching a virtual machine using the public IP address of the VM is no longer supported.
   # Instead, use resourceId of the VM.
   # The resourceId of the VM can be constructed using the following string format:
   # /subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.Compute/virtualMachines/<vm_name>.
   # You can also use subscription_id, resource_group and vm_name without constructing resourceId.
       attach_config = RemoteCompute.attach_configuration(resource_id='<resource_id>',
                                                          ssh_port=22,
                                                          username='username',
                                                          private_key_file='./.ssh/id_rsa')

       attached_dsvm_compute = ComputeTarget.attach(ws, compute_target_name, attach_config)

       attached_dsvm_compute.wait_for_completion(show_output=True)

전체 샘플은 https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/training/train-on-remote-vm/train-on-remote-vm.ipynb에서 사용할 수 있습니다.

메서드

attach

사용되지 않습니다. 대신 attach_configuration 메서드를 사용합니다.

기존 원격 컴퓨팅 리소스를 제공된 작업 영역과 연결합니다.

attach_configuration

원격 컴퓨팅 대상을 연결하기 위한 구성 개체를 만듭니다.

VM의 공용 IP 주소를 사용하여 가상 머신을 연결하는 것은 더 이상 지원되지 않습니다. 대신 VM의 resourceId를 사용합니다. VM의 resourceId는 "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/ providers/Microsoft.Compute/virtualMachines/<vm_name>" 문자열 형식을 사용하여 구성할 수 있습니다.

resourceId를 구성하지 않고 subscription_id, resource_group 및 vm_name을 사용할 수도 있습니다. 자세한 내용은 https://aka.ms/azureml-compute-vm를 참조하세요.

delete

RemoteCompute 개체에는 삭제가 지원되지 않습니다. 대신 detach를 사용하세요.

deserialize

JSON 개체를 RemoteCompute 개체로 변환합니다.

detach

연결된 작업 영역에서 RemoteCompute 개체를 분리합니다.

기본 클라우드 개체는 삭제되지 않고 연결만 제거됩니다.

get_credentials

RemoteCompute 대상에 대한 자격 증명을 검색합니다.

refresh_state

개체 속성의 내부 업데이트를 수행합니다.

이 메서드는 해당 클라우드 개체의 현재 상태에 따라 속성을 업데이트합니다. 이는 주로 컴퓨팅 상태의 수동 폴링에 사용됩니다.

serialize

이 RemoteCompute 개체를 JSON 직렬화된 사전으로 변환합니다.

attach

사용되지 않습니다. 대신 attach_configuration 메서드를 사용합니다.

기존 원격 컴퓨팅 리소스를 제공된 작업 영역과 연결합니다.

static attach(workspace, name, username, address, ssh_port=22, password='', private_key_file='', private_key_passphrase='')

매개 변수

workspace
Workspace
필수

컴퓨팅 리소스를 연결할 작업 영역 개체입니다.

name
str
필수

제공된 작업 영역 내에서 컴퓨팅 리소스를 연결할 이름입니다. 연결할 컴퓨팅 리소스의 이름과 일치하지 않아도 됩니다.

username
str
필수

리소스에 액세스하는 데 필요한 사용자 이름입니다.

address
str
필수

연결할 리소스의 주소입니다.

ssh_port
int
기본값: 22

리소스에 대해 노출된 포트입니다. 기본값은 22입니다.

password
str
필수

리소스에 액세스하는 데 필요한 암호입니다.

private_key_file
str
필수

리소스에 대한 프라이빗 키가 포함된 파일의 경로입니다.

private_key_passphrase
str
필수

리소스에 액세스하는 데 필요한 프라이빗 핵심 구입니다.

반환

컴퓨팅 개체의 RemoteCompute 개체 표현입니다.

반환 형식

예외

attach_configuration

원격 컴퓨팅 대상을 연결하기 위한 구성 개체를 만듭니다.

VM의 공용 IP 주소를 사용하여 가상 머신을 연결하는 것은 더 이상 지원되지 않습니다. 대신 VM의 resourceId를 사용합니다. VM의 resourceId는 "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/ providers/Microsoft.Compute/virtualMachines/<vm_name>" 문자열 형식을 사용하여 구성할 수 있습니다.

resourceId를 구성하지 않고 subscription_id, resource_group 및 vm_name을 사용할 수도 있습니다. 자세한 내용은 https://aka.ms/azureml-compute-vm를 참조하세요.

static attach_configuration(username, subscription_id=None, resource_group=None, vm_name=None, resource_id=None, address=None, ssh_port=22, password='', private_key_file='', private_key_passphrase='')

매개 변수

username
str
필수

리소스에 액세스하는 데 필요한 사용자 이름입니다.

subscription_id
str
기본값: None

가상 머신이 있는 Azure 구독 ID입니다.

resource_group
str
기본값: None

가상 머신이 있는 리소스 그룹의 이름입니다.

vm_name
str
기본값: None

가상 머신 이름입니다.

resource_id
str
기본값: None

기존 리소스에 대한 ARM(Azure Resource Manager) 리소스 ID입니다.

address
str
기본값: None

기존 리소스의 주소입니다.

ssh_port
int
기본값: 22

리소스에 대해 노출된 포트입니다. 기본값은 22입니다.

password
str
필수

리소스에 액세스하는 데 필요한 암호입니다.

private_key_file
str
필수

리소스에 대한 프라이빗 키가 포함된 파일의 경로입니다.

private_key_passphrase
str
필수

리소스에 액세스하는 데 필요한 프라이빗 키 구입니다.

반환

Compute 개체를 연결할 때 사용할 구성 개체입니다.

반환 형식

예외

delete

RemoteCompute 개체에는 삭제가 지원되지 않습니다. 대신 detach를 사용하세요.

delete()

예외

deserialize

JSON 개체를 RemoteCompute 개체로 변환합니다.

static deserialize(workspace, object_dict)

매개 변수

workspace
Workspace
필수

RemoteCompute 개체가 연결된 작업 영역 개체입니다.

object_dict
dict
필수

RemoteCompute 개체로 변환할 JSON 개체입니다.

반환

제공된 JSON 개체의 RemoteCompute 표현입니다.

반환 형식

예외

설명

제공된 작업 영역이 Compute가 연결된 작업 영역이 아닌 경우 ComputeTargetException을 발생시킵니다.

detach

연결된 작업 영역에서 RemoteCompute 개체를 분리합니다.

기본 클라우드 개체는 삭제되지 않고 연결만 제거됩니다.

detach()

예외

get_credentials

RemoteCompute 대상에 대한 자격 증명을 검색합니다.

get_credentials()

반환

RemoteCompute 대상에 대한 자격 증명입니다.

반환 형식

예외

refresh_state

개체 속성의 내부 업데이트를 수행합니다.

이 메서드는 해당 클라우드 개체의 현재 상태에 따라 속성을 업데이트합니다. 이는 주로 컴퓨팅 상태의 수동 폴링에 사용됩니다.

refresh_state()

예외

serialize

이 RemoteCompute 개체를 JSON 직렬화된 사전으로 변환합니다.

serialize()

반환

이 RemoteCompute 개체의 JSON 표현입니다.

반환 형식

예외