Class: GenevaDrive::ResumableStepDefinition Private

Inherits:
StepDefinition
  • Object
show all
Defined in:
lib/geneva_drive/resumable_step_definition.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.

Metadata about a resumable step definition in a workflow. Extends StepDefinition with cursor-based iteration support.

Resumable steps can iterate over large collections with checkpointing, allowing them to be suspended and resumed across job executions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, max_iterations: nil, max_runtime: nil, **options, &block) ⇒ ResumableStepDefinition

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.

Creates a new resumable step definition.

Parameters:

  • name (String, Symbol) —

    the step name

  • max_iterations (Integer, nil) (defaults to: nil) —

    maximum iterations before auto-suspend

  • max_runtime (ActiveSupport::Duration, nil) (defaults to: nil) —

    maximum runtime before auto-suspend

  • options (Hash) —

    additional options (same as StepDefinition)

  • block (Proc) —

    the block to execute (required, receives IterableStep)

Raises:



28
29
30
31
32
33
34
35
36
37
# File 'lib/geneva_drive/resumable_step_definition.rb', line 28

def initialize(name:, max_iterations: nil, max_runtime: nil, **options, &block)
  @block = block
  @max_iterations = max_iterations
  @max_runtime = max_runtime

  # Pass a dummy callable to parent since we use block instead
  super(name: name, callable: block, **options)

  validate_resumable!
end

Instance Attribute Details

#block ⇒ Proc (readonly)

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.

Returns the block to execute (receives IterableStep).

Returns:

  • (Proc) —

    the block to execute (receives IterableStep)



12
13
14
# File 'lib/geneva_drive/resumable_step_definition.rb', line 12

def block
  @block
end

#max_iterations ⇒ Integer? (readonly)

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.

Returns maximum number of iterations before auto-suspend.

Returns:

  • (Integer, nil) —

    maximum number of iterations before auto-suspend



15
16
17
# File 'lib/geneva_drive/resumable_step_definition.rb', line 15

def max_iterations
  @max_iterations
end

#max_runtime ⇒ ActiveSupport::Duration? (readonly)

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.

Returns maximum runtime before auto-suspend.

Returns:

  • (ActiveSupport::Duration, nil) —

    maximum runtime before auto-suspend



18
19
20
# File 'lib/geneva_drive/resumable_step_definition.rb', line 18

def max_runtime
  @max_runtime
end

Instance Method Details

#execute_in_context(workflow, iterable_step) ⇒ Object

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.

Executes the step block with an IterableStep in the workflow context.

Parameters:

Returns:

  • (Object) —

    the result of the step execution



51
52
53
# File 'lib/geneva_drive/resumable_step_definition.rb', line 51

def execute_in_context(workflow, iterable_step)
  workflow.instance_exec(iterable_step, &@block)
end

#resumable? ⇒ Boolean

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.

Returns true to indicate this step supports resumable iteration.

Returns:

  • (Boolean)


42
43
44
# File 'lib/geneva_drive/resumable_step_definition.rb', line 42

def resumable?
  true
end