Skip to main content
Geneva provides three ways to handle errors, in increasing complexity: factory functions, exception matchers, and full Tenacity control.

Quick Start: Factory Functions

Use factory functions for common error handling patterns:
Geneva provides four built-in factory functions:

Customizing Retry Behavior

Factory functions accept parameters to customize behavior:
Parameters:
  • 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, use Retry, Skip, and Fail matchers:
How matching works:
  1. Matchers are evaluated in order (first match wins)
  2. More specific matchers should come before general ones
  3. Unmatched exceptions fail the job

Exception Matchers

Syntax:

Message Matching

Use the match parameter to filter exceptions by their message content. The pattern is a regex:
For example, using matchers to distinguish error types:

Behavior Summary

Advanced: Full Tenacity Control

For power users who need custom callbacks or complex retry conditions, omit on_error and use error_handling=:
Note: 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, use Retry or Fail only
  • All Retry matchers must use the same backoff strategy. You cannot mix different backoff strategies in the same on_error list:
  • Invalid regex patterns are rejected at construction time:

API Reference

  • Error HandlingRetry, Skip, Fail, FatalWorkerOOMError, FatalWorkerCrashError, and all exception matcher classes
  • UDF@udf decorator on_error parameter