resque-progress
Depends on Resque 1.8 and resque-meta 1.0.0
About
Inspired by resque-status.
Unfortunately, resque-status seems incompatible with resque-meta, so this
plugin uses resque-meta to provide a similar functionality. This plugin
differs a bit because it's mainly focused on progress. The resque-meta plugin
already includes methods for finished?
, working?
, succeeded?
, etc.
Examples
class MyJob
extend Resque::Plugins::Progress
def self.perform(, *args)
(0..9).each do |i|
at(i, 10, "Lifted \#{num} heavy things. \#{10-num} more to go!")
heavy_lifting(i)
end
at(10, 10, "Finished lifting everything. Kthxbai!")
end
end
= MyJob.enqueue('stuff')
.progress.num_complete # => 0
.progress.total # => 10
.progress.percent # => 100
.progress. # => nil
# later
= MyJob.('03c9e1a045ad012dd20500264a19273c')
.finished? # => false
.progress.num_complete # => 4
.progress.total # => 10
.progress.percent # => 40
.progress. # => 'Lifted 4 heavy things. 6 more to go!'
Requirements
- resque 1.8
- resque-meta 1.0.0