Sha256: fbdfb0114718fb17104cccc05943799e3001286f46ec786d69c12ca884630b24

Contents?: true

Size: 859 Bytes

Versions: 3

Compression:

Stored size: 859 Bytes

Contents

require File.join(File.dirname(__FILE__), 'helper')

class Step1 < Pipeline::Stage::Base
  def run
    puts("Started step 1")
    # Will fail on the first time, but pass on the second
    if attempts == 1
      puts("Raising auto-recoverable error")
      raise Pipeline::RecoverableError.new
    end
    puts("Finished step 1")
  end
end

class Step2 < Pipeline::Stage::Base
  def run
    puts("Started step 2")
    # Will fail on the first time, but pass on the second
    if attempts == 1
      puts("Raising another auto-recoverable error")
      raise Pipeline::RecoverableError.new
    end
    puts("Finished step 2")
  end
end

class TwoStepPipeline < Pipeline::Base
  define_stages Step1 >> Step2
end

Pipeline.start(TwoStepPipeline.new)

Delayed::Job.work_off
# Waiting for second job to pass re-scheduling time limit
sleep(10)
Delayed::Job.work_off

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
dtsato-pipeline-0.0.8 examples/auto_recoverable_pipeline.rb
pipeline-0.0.9 examples/auto_recoverable_pipeline.rb
pipeline-0.0.8 examples/auto_recoverable_pipeline.rb