ahoward / bj Goto Github PK
View Code? Open in Web Editor NEWBackgroundjob (Bj) is a brain dead simple, zero admin, background priority queue for Rails.
License: Other
Backgroundjob (Bj) is a brain dead simple, zero admin, background priority queue for Rails.
License: Other
Hi,
When starting bj I get:
$> bj run --forever --rails_env=production --rails_root=/path/to/app
/usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/logger.rb:2: uninitialized constant Logger (NameError)
from /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj.rb:64:in load' from /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj.rb:64 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in require' from /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/bin/bj:3 from /usr/local/bin/bj:19:in
load'
from /usr/local/bin/bj:19
Look familiar?
This is ruby 1.8.7 running a rails 2.0.2 app. (I'm in the process of upgrading, but need to get this working on the current production site.)
Thanks,
Steve
set_table_name
and set_primary_key
has been deprecated since rails v3.2. I've update the repo in my forked version which I use in my rails app by specifying the git url in my Gemfile
I have RVM running a gemset for a project that uses BJ. Rails is vendored into the project and nearly all of the gems required are frozen into the project.
When I run the cucumber tests (rake cucumber:ok), I get an error from script/bj.
/Users/swishstache/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- active_record (LoadError)
from /Users/swishstache/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /Users/swishstache/dev/myproject/vendor/plugins/bj/lib/bj.rb:45
from /Users/swishstache/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /Users/swishstache/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /Users/swishstache/dev/myproject/script/bj:3
Line 45 of lib/bj.rb is not able to find active record. I used ruby-debug and set a breakpoint before the require. The gem path is available in the $LOAD_PATH (see formatted below). When I attempt to load it manually (while still on the breakpoint in ruby-debug) it still fails.
I see a reference to "Fubar gem_path issues" here http://codeforpeople.rubyforge.org/svn/bj/trunk/TODO but, I don't see any details about it.
Is this a known issue?
RubyGems Environment:
$LOAD_PATH (formatted)
"/Users/swishstache/dev/myproject/vendor/plugins/bj/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/attachment_fu/vendor",
"/Users/swishstache/dev/myproject/vendor/plugins/acts_as_list/lib",
"/Users/swishstache/dev/myproject/vendor/gems/aws-s3-0.6.2/lib/aws",
"/Users/swishstache/dev/myproject/vendor/gems/thor-0.11.7/lib",
"/Users/swishstache/dev/myproject/vendor/gems/newrelic_rpm-2.14.1/vendor/gems/metric_parser-0.1.0.pre1/lib",
"/Users/swishstache/dev/myproject/vendor/gems/faker-0.3.0/lib",
"/Users/swishstache/dev/myproject/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib",
"/Users/swishstache/dev/myproject/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7",
"/Users/swishstache/dev/myproject/app/controllers/",
"/Users/swishstache/dev/myproject/app",
"/Users/swishstache/dev/myproject/app/models",
"/Users/swishstache/dev/myproject/app/controllers",
"/Users/swishstache/dev/myproject/app/helpers",
"/Users/swishstache/dev/myproject/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/webrat/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/validates_url_format_of/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/validates_email_format_of/lib",
"/Users/swishstache/dev/myproject/vendor/gems/validatable-1.6.7/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/ultrasphinx/lib",
"/Users/swishstache/dev/myproject/vendor/gems/tzinfo-0.3.23/lib",
"/Users/swishstache/dev/myproject/vendor/gems/thor-0.11.7/lib",
"/Users/swishstache/dev/myproject/vendor/gems/simplificator-rwebthumb-0.2.6/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/simple_http_auth/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/rspec-rails/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/rspec/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/resource_this/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/resource_on_demand/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/redbox/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/recaptcha/lib",
"/Users/swishstache/dev/myproject/vendor/gems/randexp-0.1.4/lib",
"/Users/swishstache/dev/myproject/vendor/gems/rack-1.1.2/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/oink/lib",
"/Users/swishstache/dev/myproject/vendor/gems/nokogiri-1.3.3/lib",
"/Users/swishstache/dev/myproject/vendor/gems/newrelic_rpm-2.14.1/lib",
"/Users/swishstache/dev/myproject/vendor/gems/net-ssh-2.0.15/lib",
"/Users/swishstache/dev/myproject/vendor/gems/net-scp-1.0.2/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/navigation_helper/lib",
"/Users/swishstache/dev/myproject/vendor/gems/mocha-0.9.7/lib",
"/Users/swishstache/dev/myproject/vendor/gems/mislav-will_paginate-2.3.11/lib",
"/Users/swishstache/dev/myproject/vendor/gems/mikehale-daemons-1.0.12.4/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/migration_test_helper/lib",
"/Users/swishstache/dev/myproject/vendor/gems/memcache-client-1.7.5/lib",
"/Users/swishstache/dev/myproject/vendor/gems/mechanize-0.9.0/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/jslint_on_rails/lib",
"/Users/swishstache/dev/myproject/vendor/gems/image_science-1.1.3/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/http_authentication/lib",
"/Users/swishstache/dev/myproject/vendor/gems/hoptoad_notifier-2.4.8/lib",
"/Users/swishstache/dev/myproject/vendor/gems/hoe-2.3.3/lib",
"/Users/swishstache/dev/myproject/vendor/gems/haml-3.0.25/lib",
"/Users/swishstache/dev/myproject/vendor/gems/geocoder-0.9.11/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/fitter_happier/lib",
"/Users/swishstache/dev/myproject/vendor/gems/fastercsv-1.4.0/lib",
"/Users/swishstache/dev/myproject/vendor/gems/faker-0.3.0/lib",
"/Users/swishstache/dev/myproject/vendor/gems/factory_girl-1.2.3/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/event_attribute/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/dom_id/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/default_order/lib",
"/Users/swishstache/dev/myproject/vendor/gems/database_cleaner-0.5.0/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/culerity/lib",
"/Users/swishstache/dev/myproject/vendor/gems/cucumber-rails-0.3.0/lib",
"/Users/swishstache/dev/myproject/vendor/gems/cucumber-0.6.2/lib",
"/Users/swishstache/dev/myproject/vendor/gems/constructor-1.0.2/lib",
"/Users/swishstache/dev/myproject/vendor/gems/chronic-0.2.3/lib",
"/Users/swishstache/dev/myproject/vendor/gems/catalogchoice-ar_mailer-2.1.6/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/cache_fu/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/busyajax/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/bj/lib",
"/Users/swishstache/dev/myproject/vendor/gems/aws-s3-0.6.2/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/attachment_fu/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/annotate_models/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/acts_as_state_machine/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/acts_as_sanitized/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/acts_as_list/lib",
"/Users/swishstache/dev/myproject/vendor/plugins/acts-as-taggable-on/lib",
"/Users/swishstache/dev/myproject/vendor/gems/ZenTest-4.1.4/lib",
"/Users/swishstache/dev/myproject/vendor/gems/RubyInline-3.8.3/lib",
"/Users/swishstache/dev/myproject/vendor/gems/RedCloth-4.2.2/lib",
"/Users/swishstache/dev/myproject/vendor",
"/Users/swishstache/dev/myproject/config/../vendor/rails/railties/lib/../builtin/rails_info/",
"/Users/swishstache/dev/myproject/app/sweepers",
"/Users/swishstache/dev/myproject/app/presenters",
"/Users/swishstache/dev/myproject/vendor/gems/adzap-ar_mailer-2.1.5",
"/Users/swishstache/dev/myproject/vendor/gems/ar-extensions-0.9.2/lib",
"/Users/swishstache/dev/myproject/vendor/gems/builder-2.1.2/lib",
"/Users/swishstache/dev/myproject/vendor/gems/mime-types-1.16/lib",
"/Users/swishstache/dev/myproject/vendor/gems/optiflag-0.6.5",
"/Users/swishstache/dev/myproject/vendor/gems/rwebthumb-0.2.6",
"/Users/swishstache/dev/myproject/vendor/gems/thor-0.9.7",
"/Users/swishstache/dev/myproject/vendor/gems/xml-simple-1.0.11/lib",
"/Users/swishstache/dev/myproject/vendor/rails/railties",
"/Users/swishstache/dev/myproject/vendor/rails/railties/lib",
"/Users/swishstache/dev/myproject/vendor/rails/activesupport/lib",
"/Users/swishstache/dev/myproject/vendor/rails/actionpack/lib",
"/Users/swishstache/dev/myproject/vendor/rails/activerecord/lib",
"/Users/swishstache/dev/myproject/vendor/rails/actionmailer/lib",
"/Users/swishstache/dev/myproject/vendor/rails/activeresource/lib",
"/Users/swishstache/dev/myproject/vendor/gems/cucumber-0.6.2/bin/../lib",
"/Users/swishstache/dev/myproject/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.4.1",
"/Users/swishstache/dev/myproject/config/../vendor/rails/railties/lib",
"/Users/swishstache/.rvm/gems/ruby-1.8.7-p174@global/gems/rake-0.8.7/lib",
"/Users/swishstache/dev/myproject/vendor/gems/memcache-client-1.7.5/bin",
"/Users/swishstache/.rvm/gems/ruby-1.8.7-p174@mygemset/gems/json_pure-1.5.1/lib",
"/Users/swishstache/dev/myproject/vendor/gems/nokogiri-1.3.3/ext",
"/Users/swishstache/dev/myproject/vendor/gems/optiflag-0.6.5/.",
"/Users/swishstache/dev/myproject/vendor/gems/RedCloth-4.2.2/ext",
"/Users/swishstache/dev/myproject/vendor/gems/RedCloth-4.2.2/lib/case_sensitive_require",
"/Users/swishstache/.rvm/gems/ruby-1.8.7-p174@mygemset/gems/term-ansicolor-1.0.5/lib",
"/Users/swishstache/.rvm/gems/ruby-1.8.7-p174@mygemset/gems/polyglot-0.3.1/lib",
"/Users/swishstache/.rvm/gems/ruby-1.8.7-p174@mygemset/gems/treetop-1.4.9/lib",
"/Users/swishstache/.rvm/gems/ruby-1.8.7-p174@mygemset/gems/diff-lcs-1.1.2/lib",
"/Users/swishstache/.rvm/gems/ruby-1.8.7-p174@mygemset/gems/columnize-0.3.2/lib",
"/Users/swishstache/.rvm/gems/ruby-1.8.7-p174@mygemset/gems/linecache-0.43/lib",
"/Users/swishstache/.rvm/gems/ruby-1.8.7-p174@mygemset/gems/ruby-debug-base-0.10.4/lib",
"/Users/swishstache/.rvm/gems/ruby-1.8.7-p174@mygemset/gems/ruby-debug-0.10.4/cli",
"/Users/swishstache/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8",
"/Users/swishstache/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/i686-darwin10.7.0",
"/Users/swishstache/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby",
"/Users/swishstache/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/vendor_ruby/1.8",
"/Users/swishstache/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/vendor_ruby/1.8/i686-darwin10.7.0",
"/Users/swishstache/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/vendor_ruby",
"/Users/swishstache/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8",
"/Users/swishstache/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/i686-darwin10.7.0",
".",
"/Users/swishstache/dev/myproject/vendor/gems/newrelic_rpm-2.14.1/vendor/gems/dependency_detection-0.0.1.build/lib"
Hi,
I am running a Rails 2.3.2 app on Phusion Passenger. In a controller, I start a Backgroundjob job. This job is a Rake task that sends an email through Action Mailer. I get the email twice which isn't intended. Looking at the Rails logs, I see the Rails action has only been hit once, but the database queries have been executed twice, with a delay of a few miliseconds . Looking at the Bj log, I see the job has only been executed once.
When I start the exact same rake task on the command line, I only get one email and the logs don't show doubled activity.
That is why I think it has something to do with Phusion Passenger? Maybe the job gets executed once for every instance / thread? The execution is only a few miliseconds apart.
I am not sure how to further debug this issue, or where to look for more info what might be wrong.
Thank you for any help you can give me.
Ben
I upgraded my project from Ruby 1.8.7/Rails 2.3.2 to Ruby 1.9.2/Rails 2.3.8
In my environment file there is line to tell Bj not to manage the runner itself with
Bj.config["production.no_tickle"] = true if defined?(Bj)
Everything worked fined with Ruby 1.8.7 but after upgrade the application server does not start and throwing following exception
=> Booting WEBrick
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
/Users/jitendra/.rvm/gems/ruby-1.9.2-p0/gems/bj-1.0.1/lib/bj/attributes.rb:41:in block (2 levels) in attributes': wrong number of arguments (1 for 0) (ArgumentError) from /Users/jitendra/.rvm/gems/ruby-1.9.2-p0/gems/bj-1.0.1/lib/bj/attributes.rb:43:in
instance_eval'
from /Users/jitendra/.rvm/gems/ruby-1.9.2-p0/gems/bj-1.0.1/lib/bj/attributes.rb:43:in call' from /Users/jitendra/.rvm/gems/ruby-1.9.2-p0/gems/bj-1.0.1/lib/bj/attributes.rb:43:in
block (2 levels) in attributes'
from (eval):3:in call' from (eval):3:in
config!'
from (eval):4:in config' from /Users/jitendra/.rvm/gems/ruby-1.9.2-p0/gems/bj-1.0.1/lib/bj/bj.rb:15:in
block in module:ClassMethods'
from /Users/jitendra/.rvm/gems/ruby-1.9.2-p0/gems/bj-1.0.1/lib/bj/attributes.rb:43:in instance_eval' from /Users/jitendra/.rvm/gems/ruby-1.9.2-p0/gems/bj-1.0.1/lib/bj/attributes.rb:43:in
call'
from /Users/jitendra/.rvm/gems/ruby-1.9.2-p0/gems/bj-1.0.1/lib/bj/attributes.rb:43:in block (2 levels) in attributes' from (eval):3:in
call'
from (eval):3:in config!' from (eval):4:in
config'
from /Users/jitendra/projects/blocks/config/environment.rb:72:in <top (required)>' from /Users/jitendra/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in
require'
from /Users/jitendra/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in block in require' from /Users/jitendra/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in
new_constants_in'
from /Users/jitendra/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in require' from /Users/jitendra/.rvm/gems/ruby-1.9.2-p0/gems/rails-2.3.8/lib/commands/server.rb:84:in
<top (required)>'
from script/server:4:in require' from script/server:4:in
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.