Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from azureml.core import Workspace
from azureml.core.compute import ComputeTarget
from azureml.core.compute_target import ComputeTargetException
# Load the workspace from config.json
ws = Workspace.from_config()
# Now let's make sure we have a compute resource
instance_name = "My-Compute"
# Fetch or create the compute resource
try:
instance = ComputeTarget(workspace=ws, name=instance_name)
instance.delete()
instance.wait_for_completion(show_output=True)
print('Deleted compute resource')
except ComputeTargetException:
print('Already deleted!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment