0.02
No commit activity in last 3 years
No release in over 3 years
A Resque plugin that provides helpers for progress updates from within your jobs. For example: class MyJob extend Resque::Plugins::Progress def self.perform(meta_id, *args) (0..10).each do |i| at(i, 10, "Lifted #{num} heavy things. #{10-num} more to go!") heavy_lifting(i) end end end meta0 = MyJob.enqueue('stuff') meta0.progress.num_complete # => 0 meta0.progress.total # => 10 meta0.progress.percent # => 100 meta0.progress.message # => nil # later meta1 = MyJob.get_meta('03c9e1a045ad012dd20500264a19273c') meta1.progress.num_complete # => 4 meta1.progress.total # => 10 meta1.progress.percent # => 40 meta1.progress.message # => 'Lifted 4 heavy things. 6 more to go!'
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.8.0
>= 1.0.0
 Project Readme

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(meta_id, *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

meta0 = MyJob.enqueue('stuff')
meta0.progress.num_complete # => 0
meta0.progress.total # => 10
meta0.progress.percent # => 100
meta0.progress.message # => nil

# later
meta1 = MyJob.get_meta('03c9e1a045ad012dd20500264a19273c')
meta1.finished? # => false
meta1.progress.num_complete # => 4
meta1.progress.total # => 10
meta1.progress.percent # => 40
meta1.progress.message # => 'Lifted 4 heavy things. 6 more to go!'

Requirements