简体   繁体   中英

Unable to start/stop compute instance through azure machine learning using python

I'm trying to save a little money by starting/stopping AML compute instance using python. However, I'm having a bit of trouble after following instructions here .

The instructions indicate that the following code should work using Python SDK azure-ai-ml v2:

ml_client.compute.begin_stop(ci_basic_name).wait()

However, I get the following error:

"message": "StopCompute is not supported for 'AmlCompute' computes."

If anyone has had this issue and has a work around, I'd very much appreciate it.

To stop an AML compute instance, you can use the following code.

# Import the Azure Machine Learning Python SDK
from azureml.core import Workspace, ComputeInstance

# Load the workspace
ws = Workspace.from_config()

# Get the compute instance
instance = ComputeInstance(ws, "instance-name")

# Stop the compute instance
instance.stop(wait_for_completion=True, show_output=True)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM