Skip to content

Instantly share code, notes, and snippets.

@gauravkaila
Created October 11, 2018 14:06
Show Gist options
  • Save gauravkaila/e3ac92d2e7d12f63e2c36d1b4b3b4242 to your computer and use it in GitHub Desktop.
Save gauravkaila/e3ac92d2e7d12f63e2c36d1b4b3b4242 to your computer and use it in GitHub Desktop.
# Create an experiment
from azureml.core import Experiment
# NOTE: New experiment is created if one with the following name is not found
experiment_name = config['train']['experiment_name']
exp = Experiment(workspace=ws, name=experiment_name)
# Create a target compute - VM
from azureml.core.compute import DsvmCompute
from azureml.core.compute_target import ComputeTargetException
# NOTE: New compute target is created is one with the following name is not found
compute_target_name = config['train']['compute_target_name']
try:
dsvm_compute = DsvmCompute(workspace=ws, name=compute_target_name)
print('found existing:', dsvm_compute.name)
except ComputeTargetException:
print('creating new.')
dsvm_config = DsvmCompute.provisioning_configuration(vm_size= config['train']['vm_size'])
dsvm_compute = DsvmCompute.create(ws, name=compute_target_name, provisioning_configuration=dsvm_config)
dsvm_compute.wait_for_completion(show_output=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment