Skip to main content

get_log_policy

Determines the appropriate logging policy for a task failure based on the exception type and error information.

def get_log_policy(
task: Task,
einfo: ExceptionInfo,
exc: Exception
) - > LogPolicy

Determines the appropriate logging strategy for a task failure based on the exception type and error information. This function selects a policy that dictates how the error should be recorded, distinguishing between expected task behavior, internal system errors, and ignored or rejected tasks.

Parameters

NameTypeDescription
taskTaskThe task instance that encountered the error, used to check for expected exception types defined in the 'throws' attribute.
einfoExceptionInfoThe wrapper containing traceback and metadata about the exception, specifically used to identify if the error was internal to the worker.
excExceptionThe actual exception instance raised during task execution.

Returns

TypeDescription
LogPolicyThe logging policy object that defines the severity and format for recording the specific failure.