raise_exception

Applicable Products

Product

Supported

Atlas A3 training products/Atlas A3 inference products

√

Atlas A2 training products/Atlas A2 inference products

√

Atlas 200I/500 A2 inference products

x

Atlas inference products

x

Atlas training products

x

Function Description

The UDF proactively reports an exception.

Prototype

1
raise_exception(self, exception_code: int, user_context_id: int)

Parameters

Parameter

Input/Output

Description

exception_code

Input

User-defined error code for an exception.

user_context_id

Input

Context ID of a user-defined exception, which is used to identify the reported exception. This ensures that other UDFs can detect the data batch where the exception occurs based on the ID after capturing the exception.

Returns

None

Exception Handling

Print error logs.

Constraints

If exception reporting is not enabled for the current dataflow graph through set_exception_catch, calling this API will cause the process to abort with an error.

In scenarios with streaming input (the input parameter of FlowFunc is a queue), the UDF cannot proactively report exceptions.