Quick Start: Factory Functions
Use factory functions for common error handling patterns:Customizing Retry Behavior
Factory functions accept parameters to customize behavior:max_attempts(int): Maximum number of attempts (default: 3)backoff(str): Backoff strategy between retries"exponential"(default): 1s, 2s, 4s, 8s… with jitter, capped at 60s"fixed": Fixed 1s delay between attempts"linear": 1s, 2s, 3s, 4s… capped at 60s
Custom Exception Handling: Matchers
For fine-grained control, useRetry, Skip, and Fail matchers:
- Matchers are evaluated in order (first match wins)
- More specific matchers should come before general ones
- Unmatched exceptions fail the job
Exception Matchers
Syntax:
Message Matching
Use thematch parameter to filter exceptions by their message content. The pattern is a regex:
Behavior Summary
Advanced: Full Tenacity Control
For power users who need custom callbacks or complex retry conditions, omiton_error and use error_handling=:
on_error= and error_handling= cannot be used together.
Restrictions
- Skip behavior only works with scalar UDFs (functions that process one row at a time)
- For batch UDFs that receive
RecordBatch, useRetryorFailonly - All Retry matchers must use the same backoff strategy. You cannot mix different backoff strategies in the same
on_errorlist:
- Invalid regex patterns are rejected at construction time:
API Reference
- Error Handling —
Retry,Skip,Fail,FatalWorkerOOMError,FatalWorkerCrashError, and all exception matcher classes - UDF —
@udfdecoratoron_errorparameter