examples/cancelling_pipeline.rb in dtsato-pipeline-0.0.7 vs examples/cancelling_pipeline.rb in dtsato-pipeline-0.0.8
- old
+ new
@@ -1,8 +1,6 @@
-require File.join(File.dirname(__FILE__), '..', 'init')
-require File.join(File.dirname(__FILE__), '..', 'spec', 'database_integration_helper')
-ActiveRecord::Base.logger = Logger.new(STDOUT)
+require File.join(File.dirname(__FILE__), 'helper')
class Step1 < Pipeline::Stage::Base
def run
puts("Started step 1")
puts("Raising user-recoverable error")
@@ -22,11 +20,9 @@
define_stages Step1 >> Step2
end
id = Pipeline.start(TwoStepPipeline.new)
-Delayed::Worker.new.start
+Delayed::Job.work_off
-# CTRL-C to execute the cancelling, since we want to cancel after the stage failed, but
-# Worker is blocking the process on the previous line
Pipeline.cancel(id)
-p Pipeline::Base.find(id)
+puts("Pipeline is now #{Pipeline::Base.find(id).status}")