Class: GenevaDrive::PerformStepJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/geneva_drive/jobs/perform_step_job.rb

Overview

ActiveJob that executes a scheduled step execution. This is a thin wrapper that delegates all logic to the Executor.

Idempotency is guaranteed by the Executor, which:

  • Acquires locks on both workflow and step execution
  • Reloads records after acquiring locks to get fresh state
  • Only proceeds if state is still "scheduled"
  • Transitions state atomically while holding locks

Examples:

Manual execution (for testing)

PerformStepJob.perform_now(step_execution.id)

Instance Method Summary collapse

Instance Method Details

#perform(step_execution_id) ⇒ void

This method returns an undefined value.

Performs the step execution.

Parameters:

  • step_execution_id (Integer, String)

    the ID of the step execution



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/geneva_drive/jobs/perform_step_job.rb', line 75

def perform(step_execution_id)
  step_execution = find_step_execution(step_execution_id)

  unless step_execution
    logger.warn("StepExecution #{step_execution_id} not found, skipping")
    return
  end

  logger.debug("PerformStepJob starting execution for step #{step_execution_id}")
  GenevaDrive::Executor.execute!(step_execution, logger: logger)
end