让 Resque Status 与 jRuby 一起使用

发布于 2024-12-10 02:14:26 字数 2119 浏览 0 评论 0原文

我有一个应用程序,我已经为后台作业实现了 Resque 。另外,我正在使用 gem resque-schedulerresque-status,它们都可以在 Ruby 1.9.2 上顺利运行。

我的应用程序是一个 Sinatra 应用程序,我已经制作了 Rakefile,现在

require "resque/tasks"
require "resque_scheduler/tasks"

,我正在尝试在 jruby 1.6.3 (ruby-1.8.7-p330) 下运行该应用程序,但不幸的是,当我尝试运行 COUNT=2 VERBOSE=true QUEUE=* rake resque:workers 时遇到了问题。

终端抛出此错误“在将 --trace 添加到 rake 命令后”,

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)'

我跟踪了我的项目文件,发现当我从某个文件中删除 require "resque/job_with_status" 时一切正常并得到预期的错误即 Resque::JobWithStatus 无法找到

我尝试运行 jruby --1.9 -S rake ... 但它也不起作用!

那么有没有办法让resque-status 与jRuby 一起工作呢?

我已经在 github 上打开了一个问题: https://github.com/quirkey/ resque-status/issues/45

提前致谢

I have an application which I've already implement Resque for background jobs. Alos, I'm using gem resque-scheduler and resque-status and they are all work smoothly on Ruby 1.9.2.

My application is a Sinatra app and I've made my Rakefile and here its

require "resque/tasks"
require "resque_scheduler/tasks"

Now, I'm trying to run the application under jruby 1.6.3 (ruby-1.8.7-p330), but unfortunately, I got a problem when I tried to run COUNT=2 VERBOSE=true QUEUE=* rake resque:workers.

The terminal threw this error "after adding --trace to the rake command"

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)'

I tracked My projects files to find that when I remove require "resque/job_with_status" from some file It all work well and get the expected error i.e. Resque::JobWithStatus couldn't be found.

I tried to run jruby --1.9 -S rake ... but it also doesn't work!

So is there any way to get resque-status to work with jRuby?

and I've already opened an issue on github: https://github.com/quirkey/resque-status/issues/45

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文