quirkey / resque-status Goto Github PK
View Code? Open in Web Editor NEWresque-status is an extension to the resque queue system that provides simple trackable jobs.
License: MIT License
resque-status is an extension to the resque queue system that provides simple trackable jobs.
License: MIT License
While using v0.1.4 on a job detail page (eg: http://localhost:3001/statuses/eef0e98088ee012d710b0017f2d331be), the percentage changes as time passes, but the graphical progress bar remains at 0.
It seems that the initial load displays the bar properly, then it comes back to 0.
Why was choose a hash instead of use the same interface of the default enqueue method? I guess the interface would be much better if it's
def self.create(*options)
self.enqueue(self, *options)
end
def self.enqueue(klass, *options)
uuid = Resque::Status.create
Resque.enqueue(klass, uuid, *options)
uuid
end
Hi there,
Is it possible to update the Status of the job from somewhere else not inside the job?
for example:
class SleepJob < Resque::JobWithStatus
def perform
# call a method somewhere else and send the uuid
do_something(uuid)
completed
end
end
def do_something(job_id)
status = Resque::Status.get(job_id)
# Here update the status as it goes
status.total = 100
# some loop
status.num = 7
# end
end
I've been trying to do this but setting status.total and status.num does not change anything on the web interface progress or status.pct_complete is not udpated.
Maybe Im not supposed to do it this way?
Thanks!
Resque::status.kill(job_uuid) return true, but job not killed (or remove from queue).
Killing the job using resque-status works by killing the resque processes, but I need a way to trap whatever signal is sent so gracefully close down some processing that the job is done. There is (was) a discussion going on about something similar here https://github.com/defunkt/resque/pull/505 but I imagine that the use of resque-status would complicate things a bit, as each job is wrapped.
Are there any thoughts on this already that I haven't come across? Thanks
For now I'm going to fork resque_spec to see if I can hack something together, but it would be useful if resque-status came with some testing facilities.
Maybe something like this?
VideoJob.should have_queued_with_status(:queue_name)
'{"name":"ElementWorker({ "id" => "123"})","uuid":"9af80260af01012f35f700163e4df9e3","time":'
Resque::Helpers::DecodeException at /statuses
lexical error: invalid char in json text. 012f35f700163e4df9e3","time": (right here) ------^
Hi,
Is it possible to use https://github.com/bvandenbos/resque-scheduler and do Resque.enqueue_at(5.days.from_now, SendFollowUpEmail, :user_id => current_user.id)
or enqueue_in
with resque status?
Using the example you provide in this git repo, I cannot get resque-web to show anything under the statuses tab, even though the sleep_job.rb command reports the status just fine.
I've tried to turn on debug and run resque-web in the foreground to see if I could find anything suspicious, but unfortunately I can't.
Yes, the name method can be overridden, but it would be nice if by default it did
def name
"#{self.class.name}(#{options unless options.empty?})"
end
or something similar, so that the args would show in the web interface (especially when paired with resque-scheduler)
I'm following the config (mount Resque::Server.new, :at => "/resque") in my rails app existing but statuses tab is not showing in my web page.
How can I put the resque status plugin in the route my rails existing app.
PS.: Sorry for my wrong english
Resque-status is compatible with rubyonrails 3 ?
I have this error :
uninitialized constant Resque::JobWithStatus
In my Gemfile :
gem 'resque', :require => "resque/server"
gem 'resque-status'
A particularly frustrating issue I ran into with using UUID 2.0.2 was that it was trying to write a UUID to the state file and it ran into a conversion issue and could not recover from this error. I don't fully understand what caused this problem in the first place, but it occurred after updating resque-status to version 0.3.1.
The problem: UUID would try to write to the statefile in the initializer. It would pack the array of the mac addresses, the sequence and the time into the binary sequence according to the STATE_FILE_FORMAT template. Then, when actually calling io.write, it would get UndefinedConversionError. After that, it would have an empty state_file that it would try to read and unpack from, which would cause the second error.
The solution: In UUID 2.0.2, the write and read modes are always set to 'w' and 'r' in the open-lock methods. In later versions, it is 'wb' and 'rb' which allows the opened File to avoid the conversion error. A quick and dirty solution is to update the gem on your own machine so that all write and read modes include the 'b', however it would be best if we just updated the resque-status to use the latest version, 2.3.5.
For googling purposes if someone else runs into this issue, this is what the exceptions look like.
Initial problem:
Encoding::UndefinedConversionError: "\xDF" from ASCII-8BIT to UTF-8 from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:281:in `write' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:281:in `write_state' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:167:in `block in initialize' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:255:in `block in open_lock' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:252:in `open' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:252:in `open_lock' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:166:in `initialize' from (irb):1:in `new' from (irb):1 from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/railties-3.1.1/lib/rails/commands/console.rb:45:in `start' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/railties-3.1.1/lib/rails/commands/console.rb:8:in `start' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/railties-3.1.1/lib/rails/commands.rb:40:in `' from script/rails:6:in `require' from script/rails:6:in `'
Then, if If the /var/tmp/ruby-uuid exists
NoMethodError: undefined method `unpack' for nil:NilClass from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/activesupport-3.1.1/lib/active_support/whiny_nil.rb:48:in `method_missing' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:265:in `read_state' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:224:in `block in next_sequence' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:255:in `block in open_lock' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:252:in `open' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:252:in `open_lock' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:223:in `next_sequence' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:160:in `initialize' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:112:in `new' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/uuid-2.0.2/lib/uuid.rb:112:in `generate' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/resque-status-0.3.1/lib/resque/plugins/status/hash.rb:152:in `generate_uuid' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/resque-status-0.3.1/lib/resque/plugins/status/hash.rb:15:in `create' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/resque-status-0.3.1/lib/resque/plugins/status.rb:85:in `enqueue' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/resque-status-0.3.1/lib/resque/plugins/status.rb:79:in `create' from /home/developer/code/multi/vairifi2/app/helpers/Eraser.rb:33:in `async_erase' from (irb):5 from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/railties-3.1.1/lib/rails/commands/console.rb:45:in `start' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/railties-3.1.1/lib/rails/commands/console.rb:8:in `start' from /home/developer/.rvm/gems/ruby-1.9.2-p290@rails31/gems/railties-3.1.1/lib/rails/commands.rb:40:in `' from script/rails:6:in `require'
When I create a job through status, I see the "statused" queue created but the number of jobs in the "Overview" does NOT increment, and the job shows up on the "Statuses" tab in the web-ui, but workers stated with:
QUEUE=* rake rescue:work
Never pick up the jobs. The status shows them "queued" and nothing changes.
It seems like the job isn't being inserted properly for them to be visible in the queue.
Am I doing something wrong?
Hi,
For this error :
/home/ruby/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/resque-status-0.1.2/lib/resque/status.rb:181:in pct_complete': stack level too deep (SystemStackError) from /home/ruby/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/resque-status-0.1.2/lib/resque/status.rb:204:in
to_json'
from /home/ruby/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/resque-1.3.1/lib/resque/helpers.rb:15:in encode' from /home/ruby/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/resque-status-0.1.2/lib/resque/status.rb:205:in
to_json'
from /home/ruby/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/resque-1.3.1/lib/resque/helpers.rb:15:in encode' from /home/ruby/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/resque-status-0.1.2/lib/resque/status.rb:205:in
to_json'
from /home/ruby/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/resque-1.3.1/lib/resque/helpers.rb:15:in encode' from /home/ruby/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/resque-status-0.1.2/lib/resque/status.rb:205:in
to_json'
from /home/ruby/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/resque-1.3.1/lib/resque/helpers.rb:15:in encode' ... 7967 levels... from /home/ruby/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/resque-status-0.1.2/lib/resque/status.rb:18:in
create'
from /home/ruby/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/resque-status-0.1.2/lib/resque/job_with_status.rb:75:in enqueue' from /home/ruby/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/resque-status-0.1.2/lib/resque/job_with_status.rb:69:in
create'
from sleep_job.rb:28
Use this :
$ gem install yajl-ruby
Florian
Here is a diff: http://gist.github.com/517311
It looks like the # of keys in redis increases without end, constantly filling with resque-status keys.
I'm using Rails 3.x, and I have in an initializer the following:
Resque::Plugins::Status::Hash.expire_in = (60 * 60)
It seems like it's working, as when I look at http://myapp.inc/resque/statuses, and browse to the last page of statuses, they are only there for the past hour.
However, when looking at the redis keys directly, there are tens of thousands of keys that look like this:
status:c29d66b0b7c4012fb5d952540035c270
I assume that is Resque status?
Do I have something misconfigured where the keys are not being removed?
Hi, does resque-status work with resque inline? We seem to be seeing an issue wherein jobs that are supposed to be running inline instead try to connect to Redis. Thanks!
I get the following exception when trying to view the status page in resque-web. Works correctly under ruby 1.8.7 on same machine with same gem versions.
NameError - uninitialized constant Resque::Server::VIEW_PATH:
/usr/local/rvm/gems/ruby-1.9.1-p378/gems/resque-status-0.1.4/lib/resque/status_server.rb:38:in status_view' /usr/local/rvm/gems/ruby-1.9.1-p378/gems/resque-status-0.1.4/lib/resque/status_server.rb:23:in
block in registered'
/usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:865:in call' /usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:865:in
block in route'
/usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:521:in instance_eval' /usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:521:in
route_eval'
/usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:500:in block (2 levels) in route!' /usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:497:in
catch'
/usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:497:in block in route!' /usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:476:in
each'
/usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:476:in route!' /usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:601:in
dispatch!'
/usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:411:in block in call!' /usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:566:in
instance_eval'
/usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:566:in block in invoke' /usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:566:in
catch'
/usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:566:in invoke' /usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:411:in
call!'
/usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:399:in call' /usr/local/rvm/gems/ruby-1.9.1-p378/gems/rack-1.1.0/lib/rack/showexceptions.rb:24:in
call'
/usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:979:in block in call' /usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:1005:in
synchronize'
/usr/local/rvm/gems/ruby-1.9.1-p378/gems/sinatra-1.0/lib/sinatra/base.rb:979:in call' /usr/local/rvm/gems/ruby-1.9.1-p378/gems/rack-1.1.0/lib/rack/content_length.rb:13:in
call'
/usr/local/rvm/gems/ruby-1.9.1-p378/gems/rack-1.1.0/lib/rack/handler/webrick.rb:48:in service' /usr/local/rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/webrick/httpserver.rb:111:in
service'
/usr/local/rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/webrick/httpserver.rb:70:in run' /usr/local/rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/webrick/server.rb:183:in
block in start_thread'
Gem versions are as follows:
redis (2.0.5)
resque (1.9.9)
resque-status (0.1.4)
sinatra (1.0)
rack (1.1.0)
Using
Ubuntu 10.10, ruby 1.9.3 and Redis 2.4.13 with rbenv
Gems
rails (3.2.3)
resque (1.20.0)
resque-status (0.3.3)
When running the example job sleep_job.rb as explained in the documents, I am getting the following error
... 13543: Received exception when reporting failure: NameError: uninitialized constant SleepJob
The worker is started with
RAILS_ENV=production QUEUE=* be rake resque:work VVERBOSE=1
Just wanted to pointed out until I get some time to fork the project and contribute changes myself.
Suggestion:
After "Also, all the status setting methods take any number of hash arguments" it should also describe the method handling for each.
Reason:
I imagined I could set the status to failed by calling status setting methods from within a job. But I noticed
completed unless status && status.completed?
Would just set the status back to completed. Then I realized it should raise() an error, and that I could create on_failure() methods to handle it and still have access to the status object.
Thank You.
Our team uses resque-status extensively and we're quite happy with it. One feature request I have is to freeze the progress bar in place when a job fails instead of having it jump to 100%.
For example, if I have put 10 at() clauses in my worker class and the job fails after the 50% marker but before the 60% marker, it would be really helpful for me to know that it was in-between this 50-60% range that the worker failed.
Looking at the Resque web interface, I can already tell from the status column that the worker job has a "failed" status, so I know visually that it has died and is not still running. For me, having the progress bar freeze at the point it was at when the job failed would be more useful than having it jump to 100% just because the worker class has stopped running.
ExampleJob.create('test_id' => 1)
The test_id
can only be read out of the job if the job is actually performing. You can't get this option out of queued jobs.
So I monkey-patched Resque::JobWithStatus
in order to get this feature.
def self.enqueue(klass, options = {})
uuid = Resque::Status.create options
Resque.enqueue(klass, uuid, options)
uuid
end
I simply passed options
to Status.create
. Do you need a pull request for this trivial change?
def pct_complete
case status
when 'completed' then 100
when 'queued' then 0
else
t = (total == 0 || total.nil?) ? 1 : total
(((num || 0).to_f / t.to_f) * 100).to_i
end
end
If the user accidentally sets total
to a string by doing something like at(1, "This is my status")
, this method will explode by trying to call NaN.to_i
, which will cause the web app's Statuses tab to fail.
I'm happy to patch if you tell me how you'd like it done:
Jon
Fix adding require 'uuid' in an initializer.
file: status_server.rb location: status_poll line: 60
Hi, Quirkey, I tried but failed to figure out why the method of 'url' undefined or where it's defined, can you please point out which script defined the 'url' method so that I can confirm if there are some old gems I installed that not compact with your gem.
Thanks.
My job executes as expected, and I am able to retrieve the status hash from outside of the job. However, within the job, using status["myvariable"] = "myvalue", as in the readme, has no effect on the status hash.
A gist of the code / my initializer / output (this is in a rails project):
It'd be interesting to use resque-status to track job ancestry. Be able to see what job spawned another job, and track pending child jobs, etc.
status = Resque::Status.get(job_id)
status.parent => nil
status.children => [#<Resque::Status>, ...]
Any thoughts?
Hello,
I tried upgrading resque to the latest version as well as resque-status, this is what I get when I try to require the status server lib.
undefined method `register' for Resque::Server:Module
/Users/kain/.gem/ruby/1.8/gems/resque-status-0.1.4/lib/resque/status_server.rb:49
Rails 2.3.9
resque initializer: http://pastie.org/private/u3en2gjhoikxei87epba5a
I'm using Rails 3.0.9 and Ruby 1.8.7 with resque(1.19.0) + resque-status (0.2.4). Though the other tabs are showing the jobs properly, the statuses tab is showing nothing at all. It would be great if you can help me out of this.
The spec Resque::JobWithStatus .perform should set the status fails in ruby 1.8.7. The same test passes in ruby 1.9
<"WorkingJob({"num"=>100})"> expected but was
<"WorkingJob(num100)">
This is because of to_s implementation of hash differs in 1.8.7 and 1.9. Fix for this problem would be to use options.inspect instead of options.to_s
When a job fails or complete, we get information about it but when it is queued we don't have any information. Is there a way to get any details for queued job?
While I restart resque workers during deploy if new job comes in, then these jobs are set as queued in resque-status but it's not actually queued in resque. So my jobs are lost.
ruby-1.9.2-p180 :027 > status=Resque::Status.get("f050dd20bc45012e1e77723c9193eb99")
=> #<Resque::Status {"time"=>1315485749, "status"=>"queued", "uuid"=>"f050dd20bc45012e1e77723c9193eb99"}>
ruby-1.9.2-p180 :022 > status.status
=> "queued"
ruby-1.9.2-p180 :033 > Resque.info
=> {:pending=>0, :processed=>12943, :queues=>9, :workers=>10, :working=>0, :failed=>8911, :servers=>["redis://192.168.###.###:6379/0"], :environment=>"production"}
As you can see there are 12 jobs with queued status but they're not showing up in Queues tab as there is no job pending in resque.
Please take a look at this behaviour.
Is there any method to requeue these workers??
I can see the status in resque-web -> stats -> status:1 getting updated which tells me that the status in redis is being created and updated. It's just not showing in "Statuses" tab.
environment:
osx 10.6.6
redis 2.2.1
resque 1.14.0
resque-status 0.2.2
rails 3.0.5
ruby 1.9.2-p136
Thanks!
redis -------------------
24 Jan 18:16:14 - Server started, Redis version 1.01
resque --------------
$ sudo gem search resque
*** LOCAL GEMS ***
resque (1.3.1)
resque-status (0.1.1)
stacktrace -----------------
$ ruby -rrubygems examples/sleep_job.rb
Creating the SleepJob
/opt/local/lib/ruby/gems/1.8/gems/redis-0.1.1/lib/redis.rb:342:in read_reply': -ERR unknown command (RuntimeError) from /opt/local/lib/ruby/gems/1.8/gems/redis-0.1.1/lib/redis.rb:249:in
process_command'
from /opt/local/lib/ruby/gems/1.8/gems/redis-0.1.1/lib/redis.rb:247:in map' from /opt/local/lib/ruby/gems/1.8/gems/redis-0.1.1/lib/redis.rb:247:in
process_command'
from /opt/local/lib/ruby/gems/1.8/gems/redis-0.1.1/lib/redis.rb:240:in raw_call_command' from /opt/local/lib/ruby/gems/1.8/gems/redis-0.1.1/lib/redis.rb:255:in
synchronize'
from /opt/local/lib/ruby/gems/1.8/gems/redis-0.1.1/lib/redis.rb:255:in maybe_lock' from /opt/local/lib/ruby/gems/1.8/gems/redis-0.1.1/lib/redis.rb:240:in
raw_call_command'
from /opt/local/lib/ruby/gems/1.8/gems/redis-0.1.1/lib/redis.rb:195:in call_command' from /opt/local/lib/ruby/gems/1.8/gems/redis-0.1.1/lib/redis.rb:183:in
method_missing'
from /opt/local/lib/ruby/gems/1.8/gems/redis-namespace-0.1.1/lib/redis/namespace.rb:99:in send' from /opt/local/lib/ruby/gems/1.8/gems/redis-namespace-0.1.1/lib/redis/namespace.rb:99:in
method_missing'
from /opt/local/lib/ruby/gems/1.8/gems/resque-status-0.1.1/lib/resque/status.rb:19:in create' from /opt/local/lib/ruby/gems/1.8/gems/resque-status-0.1.1/lib/resque/job_with_status.rb:75:in
enqueue'
from /opt/local/lib/ruby/gems/1.8/gems/resque-status-0.1.1/lib/resque/job_with_status.rb:69:in `create'
from examples/sleep_job.rb:27
when i use require 'resque/status_server'
in my rails app config/initializers/resque.rb
, it failed, error msg
/usr/local/rvm/gems/ruby-1.9.3-p0/gems/resque-status-0.2.4/lib/resque/status_server.rb:73:in `<top (required)>': uninitialized constant Resque::Server (NameError)
i use
require 'resque/server'
require 'resque/status_server'
,it succeed
i think gem lib/resque/status_server.rb
should add the following code when Resque::Server.register Resque::StatusServer
require 'resque/server'
The README says this should work..
complete('filename' => '/myfilename')
However, after looking into the code, what worked for me is this :
completed('filename' => '/myfilename')
Also, using status as a hash and appending to it did not work for me. You might want to try promoting completed() as a means to append to the status hash instead of having users trying to manipulate it directly.
The Redisk::Logger
never gets an expiry set on its key, so these loggers persist past the Status
's expiry window.
Seems that this needs two things:
redis.expire
for the logger_key
when creating the logger, andredis.zremrangebyscore
in Redisk::IO when adding a new IO name to the dir
, like the one in Resque::Status.create
When I add resque-status to my gemfile and run bundle update, bundler uses resque 1.8.2 and not the latest 1.19.0.
Is this on purpose?
Any chance this could be modified to be a mixin instead of a subclass?
If a before_enqueue
hook returns false, the job is not queued, but a status is created for it anyhow saying it is queued.
(duplicate of #56)
There doesn't seem to be a simple way to run the code without resque.This is useful for testing code.
I'm thinking of throwing together a patch which would publish statuses to Redis and wanted to see if anyone had thoughts on it or had done anything similar.
My basic use case is that I'd like to be notified as soon as a job completes. Instead of polling for completion every few seconds, it'd be much easier to subscribe to Redis and receive a message as soon as that job completes. I can also see some usefulness in receiving messages when statuses change.
Has anyone done something similar or have any thoughts?
Running rake test from latest master I'm seeing the following 6 test failures... An environmental thing on my end maybe? I'm running Redis 1.2.1 too.
Thanks!
Hey!
Right now, when a job isn't completed yet, we have access to it's options, but after it's completed the options vanish and become instead part on the 'name' string. Am I seeing this right, or is there another way to access them after completion?
Thanks!
The scheduled method is passing args to create method inside an array. This happens because args are not splatted when calling create method.
Eg: If args passed to scheduled is {:num => 100}, it is passes as [{:num => 100}] to create method.
I'll attach a pull request containing fix for this bug.
I'm not sure why when I require resque-status in my sinatra app I get this error:
when running COUNT=2 VERBOSE=true QUEUE=* rake resque:workers --trace
for example;
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
MongoDB logging. Please note that logging negatively impacts performance and should be disabled for high-performance production apps.
MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1)
rake aborted!
can't convert Class into String
org/jruby/RubyFile.java:872:in `basename'
org/jruby/RubyFile.java:1069:in `extname'
(eval):3:in `extname_with_potential_path_argument'
/Users/amr/.rvm/gems/jruby-1.6.3@global/gems/rake-0.9.2/lib/rake/application.rb:561:in `load_imports'
/Users/amr/.rvm/gems/jruby-1.6.3@global/gems/rake-0.9.2/lib/rake/application.rb:502:in `raw_load_rakefile'
/Users/amr/.rvm/gems/jruby-1.6.3@global/gems/rake-0.9.2/lib/rake/application.rb:78:in `load_rakefile'
/Users/amr/.rvm/gems/jruby-1.6.3@global/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/amr/.rvm/gems/jruby-1.6.3@global/gems/rake-0.9.2/lib/rake/application.rb:77:in `load_rakefile'
/Users/amr/.rvm/gems/jruby-1.6.3@global/gems/rake-0.9.2/lib/rake/application.rb:61:in `run'
/Users/amr/.rvm/gems/jruby-1.6.3@global/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/amr/.rvm/gems/jruby-1.6.3@global/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/amr/.rvm/gems/jruby-1.6.3@global/gems/rake-0.9.2/bin/rake:32:in `(root)'
org/jruby/RubyKernel.java:1063:in `load'
/Users/amr/.rvm/gems/jruby-1.6.3@global/bin/rake:19:in `(root)'
When resque forks the job, resque-status uses the same connection as the parent job which can cause intermittent errors such as
NoMethodError: undefined method each' for 1:Fixnum /gems/resque-status-0.3.3/lib/resque/plugins/status/hash.rb:41:in
clear'
TypeError: can't convert Fixnum into String
/gems/resque_unit-0.4.1/lib/resque_unit/helpers.rb:24:in `decode'
NoMethodError: undefined method each' for #<String:0x0000010230cdb8> /gems/resque-status-0.3.3/lib/resque/plugins/status/hash.rb:41:in
clear'
we are now using Resque.after_fork to re-initialize the redis connection
Saw the comment in resque-status/lib/resque/status.rb #status_ids explaining that we expect a reverse chronological ordering of statuses but the tab on resque-web doesn't behave this way.
# Return the <tt>num</tt> most recent status/job UUIDs in reverse chronological order.
def self.status_ids(range_start = nil, range_end = nil)
...
(redis.zrevrange(set_key, -(range_end.abs), -(range_start.abs)) || []).reverse
end
end
Just need to remove the call to #reverse in that line above since Redis zrevrange already does this for us. Would send a pull request but seems relatively trivial. Do you need me to do that still?
Thanks for a great plugin btw!
Hi,
I'm setting failed('Job failed')
at the end of my worker perform but the status still says completed.....
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.