AzureMLException 类

所有 Azure 机器学习异常的基类。

此类扩展 Python Exception 类。 如果尝试仅捕获 Azure ML 异常,则使用此类捕获它们。

继承
builtins.Exception
AzureMLException

构造函数

AzureMLException(exception_message, inner_exception=None, target=None, details=None, message_format=None, message_parameters=None, reference_code=None, **kwargs)

参数

exception_message
str
必需

描述错误的消息。

inner_exception
str
默认值: None

可选错误消息,例如来自以前处理的异常的错误消息。

target
str
默认值: None

导致引发异常的元素的名称。

details
list(str)
默认值: None

有关该错误的任何其他信息,例如其他错误响应或堆栈跟踪。

message_format
默认值: None
message_parameters
默认值: None
reference_code
默认值: None

注解

下面的代码示例演示如何处理 WebserviceException,它是 AzureMLException 的子类。 在代码中,如果服务检查失败,则处理 WebserviceException 并可以输出消息。


   from azureml.core.model import InferenceConfig
   from azureml.core.webservice import AciWebservice


   service_name = 'my-custom-env-service'

   inference_config = InferenceConfig(entry_script='score.py', environment=environment)
   aci_config = AciWebservice.deploy_configuration(cpu_cores=1, memory_gb=1)

   service = Model.deploy(workspace=ws,
                          name=service_name,
                          models=[model],
                          inference_config=inference_config,
                          deployment_config=aci_config,
                          overwrite=True)
   service.wait_for_deployment(show_output=True)

完整示例可从 https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/deployment/deploy-to-cloud/model-register-and-deploy.ipynb 获取

方法

print_stacktrace

print_stacktrace

print_stacktrace()

属性

inner_exception

返回内部异常消息。

返回

内部异常消息。

返回类型

str

message

返回错误消息。

返回

错误消息。

返回类型

str