import datetime import time from azureml.core.compute import ComputeTarget, ComputeInstance from azureml.core.compute_target import ComputeTargetException # Choose a name for your instance # Compute instance name should be unique across the azure region compute_name = "ci{}".format(ws._workspace_id)[:10] # Verify that instance does not exist already try: instance = ComputeInstance(workspace=ws, name=compute_name) print('Found existing instance, use it.') except ComputeTargetException: compute_config = ComputeInstance.provisioning_configuration( vm_size='STANDARD_D3_V2', ssh_public_access=False, # vnet_resourcegroup_name='<my-resource-group>', # vnet_name='<my-vnet-name>', # subnet_name='default', # admin_user_ssh_public_key='<my-sshkey>' ) instance = ComputeInstance.create(ws, compute_name, compute_config) instance.wait_for_completion(show_output=True)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter