AzureML报错:无法在创建状态的p2b-sample-endpoint端点创建部署
解决Azure ML中“无法在创建状态的端点中创建部署”的错误
问题根源
- 端点未就绪就发起部署:错误提示明确说明,无法在处于创建(Creating)预配状态的端点中部署资源——你在创建端点后未等待其完成预配,就立即执行了部署请求。
- 代码语法错误:
ManagedOnlineEndpoint的定义未正确闭合,就直接嵌套了ManagedOnlineDeployment的初始化逻辑,导致代码执行逻辑异常。
修复方案
步骤1:修正代码语法,拆分端点与部署的定义
步骤2:等待端点创建完成后再执行部署
使用.result()方法阻塞代码,直到端点进入Succeeded状态;也可使用wait_for_completion()实现非阻塞式等待。
修正后的代码
online_endpoint_name = "p2b-sample-endpoint" # 创建在线端点并等待完成 endpoint = ManagedOnlineEndpoint( name=online_endpoint_name, description="this is a sample online endpoint", auth_mode="key", tags={"foo": "bar"}, ) # 提交创建请求并等待端点就绪 ml_client.begin_create_or_update(endpoint).result() # 创建并提交部署请求 blue_deployment = ManagedOnlineDeployment( name="blue", endpoint_name=online_endpoint_name, model=model, environment=env, code_configuration=CodeConfiguration( code="./", scoring_script="score.py" ), instance_type="Standard_DS2_v2", instance_count=1, ) ml_client.online_deployments.begin_create_or_update(blue_deployment).result()
额外排查建议
- 可通过
ml_client.online_endpoints.get(online_endpoint_name)主动查询端点当前状态,确认是否就绪。 - 若仍出现日志为空的情况,可在端点创建完成后,重新触发部署并查看Azure ML Studio中的端点日志面板。
原始错误信息
HttpResponseError: (UserError) 无法在端点p2b-sample-endpoint中创建部署,因为该端点处于创建(Creating)预配状态。
错误代码:UserError
错误信息:无法在端点p2b-sample-endpoint中创建部署,因为该端点处于创建(Creating)预配状态。
附加信息
Additional Information: Type: ComponentName Info: { "value": "managementfrontend" } Type: Correlation Info: { "value": { "operation": "295e1dadc1e11a2db8a470788ec6494f", "request": "adb9c5f973b580b9" } } Type: Environment Info: { "value": "westeurope" } Type: Location Info: { "value": "westeurope" } Type: Time Info: { "value": "2023-03-27T20:16:26.6786058+00:00" } Type: InnerError Info: { "value": { "code": "BadArgument", "innerError": { "code": "EndpointNotReady", "innerError": null } } } Type: MessageFormat Info: { "value": "Cannot create a deployment in endpoint {endpointName} because it is in {state} provisioning state." } Type: MessageParameters Info: { "value": { "endpointName": "p2b-sample-endpoint", "state": "Creating" } }
注:未找到部署日志,日志文件夹为空
内容的提问来源于stack exchange,提问作者Kaushik J
相关产品推荐
相关产品推荐

