ruby - Resque - Not Processing Queue -
i have web based app built using sinatra. recent needing collect data @ regular intervals , store them in database. told use resque
, clockwork
gems in combine.
every hour or need 15 calculations based on database , store results in database.
so approach took. decided make 15 classes have perform
method ( exact file used testing below ). thing similar resque.enqueue( graphdata )
15 classes.
class graphdata @queue = :graph_data def self.init() end def self.perform() file.open( '/home/ziyan/desktop/resque.txt', 'a' ) { | file | file.write( "resqueu - performed - #{time.now}\n" ) } end end
to trigger operation testing purposes, created rake task.
desc "start resque workers queue" # {{{ task :graph_data |t| env["queue"] = "*" env["vverbose"] = "1" env["interval"] = "5" resque.enqueue( graphdata ) #resque = resque.new #resque << adminworker.new end # }}}
as see, in graphdata
class, under self.perform
method writing file.
my problem doesn't! have done thing wrong?
rake graph_data
show no output. web interface show job in queue
.
additional information
i added rake
task running web interface.
desc "start resque web frontend" # {{{ task :resque_web_frontend |t| sh "resque-web -p 8282" puts "resque web frontend running on http://localhost:8282" end # }}
over their, thing interesting seen. run rake task, under stats
pending
value increases not processed.
under queues -> graph_data see thing this.
class args graphdata [] graphdata [] graphdata []
what ended with:
desc "start resque workers queue" # {{{ task :graph_data |t| env["queue"] = "*" env["vverbose"] = "1" env["interval"] = "5" rake::task[ "resque:work" ].invoke resque.enqueue( graphdata ) #resque = resque.new #resque << adminworker.new end # }}}
is in development or production? describe, looks not lauching resque process. how running app? i'm more familiar using resque rails, should have run like:
rake resque:work queue='*'
to have resque worker start.
Comments
Post a Comment