Created
July 5, 2022 03:50
-
-
Save IntegerMan/24103bc0ee748ef42f569e95459a525c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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