Class: GenevaDrive::Executor Private
- Inherits:
-
Object
- Object
- GenevaDrive::Executor
- Defined in:
- lib/geneva_drive/executor.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Executes a single step within a workflow context. Handles flow control signals, exception handling, and state transitions.
The Executor owns the step execution and workflow during execution, using pessimistic locking to ensure atomicity of state transitions.
Execution phases:
- Acquire locks, validate states, transition to executing/performing
- Release locks, execute user code (step block)
- Acquire locks, handle flow control result, transition to final states
Constant Summary collapse
- STEP_TRANSITIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Valid state transitions for step executions
{ "scheduled" => %w[scheduled in_progress canceled skipped failed completed], "in_progress" => %w[in_progress completed failed canceled skipped] }.freeze
- WORKFLOW_TRANSITIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Valid state transitions for workflows
{ "ready" => %w[ready performing canceled paused finished], "performing" => %w[ready performing canceled paused finished] }.freeze
Class Method Summary collapse
-
.execute!(step_execution, logger: nil) ⇒ void
private
Executes a step execution with full flow control and exception handling.
Instance Method Summary collapse
-
#call(step_execution, logger: nil) ⇒ void
private
Performs the step execution.
Class Method Details
.execute!(step_execution, logger: nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Executes a step execution with full flow control and exception handling.
41 42 43 |
# File 'lib/geneva_drive/executor.rb', line 41 def self.execute!(step_execution, logger: nil) new.call(step_execution, logger: logger) end |
Instance Method Details
#call(step_execution, logger: nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Performs the step execution.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/geneva_drive/executor.rb', line 50 def call(step_execution, logger: nil) @step_execution = step_execution @workflow = step_execution.workflow # Build the full logger chain (base -> workflow -> step tags) and inject # it so step code calling `logger` gets the fully-tagged step execution # logger. Falls back to Rails.logger if no logger is provided. step_logger = build_step_logger(logger || Rails.logger, step_execution) @workflow.with_logger(step_logger) do step_execution.with_logger(step_logger) do execute_with_logger(step_execution) end end end |