Skip to content

Utilities API

Helper functions and utilities used internally by AntFlow.

Overview

The antflow.utils module provides standardized logging and error handling utilities.

Function Reference

extract_exception

extract_exception(error: Exception) -> Exception

Extract the original exception from a RetryError or return the error as-is.

Parameters:

Name Type Description Default
error Exception

The exception to extract from

required

Returns:

Type Description
Exception

The original exception if available, otherwise the input error

setup_logger

setup_logger(name: str, level: int = logging.INFO) -> logging.Logger

Set up a logger with consistent formatting.

Parameters:

Name Type Description Default
name str

Logger name

required
level int

Logging level

INFO

Returns:

Type Description
Logger

Configured logger instance

get_task_name

get_task_name(task: Any) -> str

Get a friendly name for a task callable. Handles standard functions, functools.partial, and custom callable objects.