我将使用新的Azure ML包更新现有的Web服务它失败,出现错误-AttributeError:"str"对象没有属性"id">
"opt/hostedtoolcache/Python/3.6.4/x64/lib/python3.6/site packages/azureml/core/webservice/aks.py";,第678行,更新
patch_list.append({'op':'replace','path':'/imageId','value':image.id}(
AttributeError:"str"对象没有属性"id">
这是我正在使用的脚本-
ws = Workspace.get(
name=workspace_name,
subscription_id=subscription_id,
resource_group=resource_group,
auth=cli_auth)
model = Model.register(model_path = model_path,
model_name = model_name,
#tags = {"key": "1"},
description = model_description,
workspace = ws)
image_config = ContainerImage.image_configuration(execution_script="score.py",
runtime="python",
conda_file="packagesenv.yml")
image = 'testazureml'
service_name = 'testazureml'
# Retrieve existing service
service = Webservice(name = service_name, workspace = ws)
print(service)
service.update(image,'image.id')
请帮忙我一直在尝试不同的方法as-"id","image_id"其仍在失败的
这里是要注册和部署的示例。
更新已部署web服务的文档:https://learn.microsoft.com/en-us/azure/machine-learning/how-to-deploy-update-web-service
这对我有效。上面的脚本无法获取图像详细信息-
ws = Workspace.get(
name=workspace_name,
subscription_id=subscription_id,
resource_group=resource_group,
auth=cli_auth)
model = Model.register(model_path = model_path,
model_name = model_name,
#tags = {"key": "1"},
description = model_description,
workspace = ws)
image_config = ContainerImage.image_configuration(execution_script="score.py",
runtime="python",
conda_file="packagesenv.yml")
image = 'testazureml'
service_name = 'testazureml'
new_image = Image(ws, image)
# Retrieve existing service
service = Webservice(name = service_name, workspace = ws)
print(service)
service.update(image=new_image)
service.wait_for_deployment(show_output=True)
print(service.state)