简体   繁体   中英

Delete and list out the all models and deployment service from Azure Machine Learning Service using python

How to get all models and deployment service from Azure Machine Learning Service and how to delete it using python.

Is there any way to list, delete all models and deployment services from Azure ML Service using python?

The Model Class has methods to help you accomplish this task. Check out delete and list methods.

Sample code:

from azureml.core import Workspace
ws = Workspace.get(name="your_workspace_name",
           subscription_id='your_subscription_id',
           resource_group='your_resource_group')


from azureml.core import Model
for model in Model.list(ws):
    print('name:', model.name, '\nversion:', model.version, '\n')
Model(ws, name = 'model_name', version = 'model_version').delete()


from azureml.core import Webservice
for webservice in Webservice.list(ws):
    print('name:', webservice.name)
Webservice(ws, name = 'webservice').delete()

Thanks.

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