-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot get Qless up and running - too difficult to install #168
Comments
@ronalchn -- thanks for taking the time to try Qless out and caring enough to report your problems rather than just moving on. Are you using the Qless gem from rubygems.org or using Qless HEAD from github? Things are a bit different between the two. The fact that you're getting qless = Qless::Client.new(redis: redis_connection)
queues = %w[ foo bar ].map { |name| qless.queues[name] }
job_reserver = Qless::JobReservers::ShuffledRoundRobin.new(queues)
worker = Qless::Workers::ForkingWorker.new(queues).run (Note that this only works against github HEAD; for the released gem I believe the rake task should still work). As for instructions for integrating into Rails: the reason we don't have that is because we're not using Qless with any rails projects. Our projects that use Qless are using sinatra for the HTTP bits. The general "here's how you use Qless with a ruby project" instructions (which I agree could be fleshed out some more) should work with Rails; for Rails there'll probably be some standard places you put the bits of code (such as a config initializer). Anyhow, we're happy to accept a PR to improve our docs with respect to Rails. Let us know if you have any other pain points; we definitely want to solve them. |
Ok, I decided to have another go at it. I had to change the code you gave me: namespace :qless do
task :work => :environment do
require 'qless/job_reservers/ordered'
require 'qless/worker'
queues = %w[judge].map { |name| $qless.queues[name] }
job_reserver = Qless::JobReservers::Ordered.new(queues)
worker = Qless::Workers::ForkingWorker.new(job_reserver, :num_workers => 2, :interval => 2).run
end
end Also, put in pull request #169 so that the password is used. Other than that - can the redis version dependency be increased? It is 2.2, which means that Also, instead of making my own global variable - class Qless::Client
def self.establish_connection(options = {})
@client = self.new(options)
end
def self.client
establish_connection if @client.nil?
@client
end
def self.queues
client.queues
end
...
end I like the idea of using You might also want to think about adding connection pool support, just because it is quite hard for anyone to use a connection pool properly if they are using a multi-threaded server, but it can be as simple as changing your |
It's You mention our travis build matrix doesn't test 2.2, and you're right. It would be good to have it continue to run builds against 2.2 but we haven't put the effort into that.
The lack of a global
It's unclear to me what advantage this would provide us. Writing multi-threaded code to work with Qless is trivial: just use a separate |
Is the |
I've only just recently put Sidekiq into my Rails application, and when I looked at Qless, I saw that many of the features would be useful. My context is to use it for CPU-intensive jobs, which take 2 seconds - several minutes each. This means that the queuing part of it doesn't have to be so fast, and Qless, with the extra book keeping, provides useful statistics, so the O(log n) data structures it uses seems ideal.
Looking through the readme, it was obvious that there are many rough edges, but I decided to try to integrate it. The rough edges include the fact that gems normally present a simple, canonical way to install and configure the gem. That is, to say, place a line in your Gemfile, create an config/initializers/qless.rb file, etc. However, there is a lot of setup code (eg. client = Qless::Client.new) where it is not specified where it is normally placed.
It is also frustrating that there seems to be different places to configure the redis connection, and different ways it must be done. For example, the
Qless::Client.new(redis options here)
, and the Rakefile environment variables.After following the steps, I wasn't able to run
rake qless:work
, getting this error:And this is after a lot of time was spent searching the codebase for where this mystery class is specified. No amount of grepping would reveal where the code is, and there doesn't appear to be any code connecting the rake task to the "*Worker" classes. The environment variables asked for in the Rakefile also do not appear to be used anywhere in the gem.
It appears that perhaps the master branch is a non-working version, or something strange is happening. In fact, the readme does not say which branch or version of the gem is the latest working version.
It almost seems that this gem has had a lot of work stuffing it with features, but no work on making it easy to use, or obvious how to get it working in a canonical way. Each section of the readme is too focused on the feature it is describing, but the readme does not have a clear structured narrative of how to quickly get started, and integrated into an existing application - such as a Rails application.
The text was updated successfully, but these errors were encountered: