class ExecutionFailureHandler
Circuit breaker: marks an execution as failed, tracks consecutive failures on the maintenance plan (pausing it after the plan’s threshold), records the failure as an error event, and frees the per-table lock. The engine lifecycle is the supervisor’s job.
Constants
- TERMINAL_STATUSES
-
Marks the execution failed and records an error event.
Public Class Methods
# File app/services/execution_failure_handler.rb, line 12 def self.handle(execution, error_message, scale_down: true) new(execution, error_message, scale_down: scale_down).call end
Convenience entry point: builds a handler and runs it.
@param execution [ExecutionHistory] the failed execution @param error_message [String] the failure message @param scale_down [Boolean] whether to release the per-table lock @return [ExecutionHistory] the handled execution
# File app/services/execution_failure_handler.rb, line 21 def initialize(execution, error_message, scale_down:) @execution = execution @error_message = error_message @scale_down = scale_down @plan = execution.maintenance_plan @table = execution.iceberg_table end
Creates the handler for a failed execution.
@param execution [ExecutionHistory] the failed execution @param error_message [String] the failure message @param scale_down [Boolean] whether to release the per-table lock
Public Instance Methods
Source
# File app/services/execution_failure_handler.rb, line 37 def call return @execution if TERMINAL_STATUSES.include?(@execution.status) fail_execution increment_and_maybe_pause release_table_lock @execution end
Runs the failure handling sequence and returns the updated execution.
Idempotent: an execution already in a terminal state is returned untouched. Without this guard, only fail_execution bailed early while increment_and_maybe_pause still bumped the plan’s consecutive_failures — a double-handled execution over-counted and auto-paused the plan early (#209).
@return [ExecutionHistory] the updated execution