denniskuczynski / beanstalkd_view Goto Github PK
View Code? Open in Web Editor NEWA Sinatra app to view/manage beanstalkd queues that can be embedded in a Rails app similar to what's available in Resque
License: MIT License
A Sinatra app to view/manage beanstalkd queues that can be embedded in a Rails app similar to what's available in Resque
License: MIT License
Thanks for open sourcing this app! I've been playing around with this on my machine and wished it could list out jobs on a tube based on status.
The same thing could apply to all of the other job status on that tube.
We have a really janky script that does this now
@qty.times do
job = @beanstalk.reserve(1)
@jobs[job] = job.stats
job.release(job.pri, 10)
end
This is surprisingly useful and reasonable fast at ~ 100 jobs.
BTW if you're interested in https://github.com/polleverywhere/quebert I'd love to make this the official web GUI tool!
When I run beanstalkd_view on my local machine it works fine. On my test server and my production servers however the static files are not being served. e.g. css/beanstalkd_view.css is just empty when I request it via the browser. The same happens on JS files.
There are some minor issues with displaying site like: name of tube overlaps with 'Pause Tube' on the right side (they belong to the div with the same class - span6). It occurs only if the name of tube is long.
There are also some syntax problems in html which is generated.
e.g
on the main site '/'
<tr>
<td>localhost:11300</a></td>
</tr>
on the site with tube details
<h3>Clear Tube</h3>
<form id="clear_form" class="well form-inline" name="clear_form" action="/clear" method="POST">
<input id="form_tube_name" type="hidden" name="tube" value="launchmebyyourself.app.devel.jobs/script-job">
<input id="form_url_base" type="hidden" name="url_base" value="/">
<select name="state"class="span3">
<option value="buried"/>Buried</option>
<option value="ready"/>Ready</option>
<option value="delayed">Delayed</option>
</select>
<button type="submit" class="btn">Clear</button>
</form>
Hi !
If I'm not mistaken, you didn't release the gem version 2.0.0
.
Thank you !
When job is defined inside a module fully qualified name of tube contains '/'. It makes that sinatra app cannot match this path to any of its routes.
e.g.
module SomeModuleWithJobs
class FirstJob
include Backburner::Queue
def self.perform()
# ...
end
end
name of tube in this case will be "{namespace}.some-module-with-jobs/first-job" In this case when clicking on a sinatra app in hyperlink with name of tube sinatra cannot match this name to any route which is known.
Regards,
Mateusz
Some companies will only use gems with a certain license.
The canonical and easy way to check is via the gemspec
via e.g.
spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']
Bundler now generates gems with a default 'MIT' license. There is even a License Finder
to help companies ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec.
Including a license in your gemspec is a good practice, in any case.
If you need help choosing a license, github has created a license picker tool
How did I find you?
I'm using a script to collect stats on gems, originally looking for download data, but decided to collect licenses too,
and make issues for gemspecs not specifying a license as a public service :)
So far it's going pretty well.
I've written a blog post about it
It would be nice if in uptime section there would be more human-readable format. Number of seconds doesn't give us needed information immediately.
Maybe something in this fashion. http://stackoverflow.com/a/6552812/1028640
Hello.
I added this application to my existing Rails app.
mount BeanstalkdView::Server, :at => "/bs"
Also made simple initializer
BeanstalkdView::Server.use(Rack::Auth::Basic) do |user, password|
user == 'myusername' && password == "myveryeasypassword"
end
After that, rake assets:precompile at the server stopped working.
Well, I switched off
config.action_dispatch.x_sendfile_header
just in case.
Ruby 2.0 via rvm
Rails 3.2.12
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
Command failed with status (): [/home/myusername/.rvm/rubies/ruby-2.0.0-p0/bi...]
/home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils.rb:53:in block in create_shell_runner' /home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in
call'
/home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in sh' /home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:37:in
sh'
/home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils.rb:80:in ruby' /home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:37:in
ruby'
/home/myusername/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.12/lib/sprockets/assets.rake:12:in ruby_rake_task' /home/myusername/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.12/lib/sprockets/assets.rake:21:in
invoke_or_reboot_rake_task'
/home/myusername/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.12/lib/sprockets/assets.rake:29:in block (2 levels) in <top (required)>' /home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:246:in
call'
/home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:246:in block in execute' /home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:241:in
each'
/home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:241:in execute' /home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:184:in
block in invoke_with_call_chain'
/home/myusername/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/monitor.rb:211:in mon_synchronize' /home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:177:in
invoke_with_call_chain'
/home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:170:in invoke' /home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:143:in
invoke_task'
/home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:101:in block (2 levels) in top_level' /home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:101:in
each'
/home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:101:in block in top_level' /home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:110:in
run_with_threads'
/home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:95:in top_level' /home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:73:in
block in run'
/home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:160:in standard_exception_handling' /home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:70:in
run'
/home/myusername/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/bin/rake:33:in <top (required)>' /home/myusername/.rvm/gems/ruby-2.0.0-p0@global/bin/rake:19:in
load'
/home/myusername/.rvm/gems/ruby-2.0.0-p0@global/bin/rake:19:in <main>' /home/myusername/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in
eval'
/home/myusername/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `
I am integrating beantstalkd_view into a Rails 4.1 app with Active Admin :
Rails.application.routes.draw do
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
get 'admin/background_jobs/beanstalkd/admin/login', to: redirect('/admin/login')
authenticate :admin_user do
mount BeanstalkdView::Server, at: "admin/background_jobs/beanstalkd"
end
end
This works fine in development, but somehow, on my staging server in production
mode session is lost between each page of the sinatra front-end and I have to login again.
Any idea why? I've never integrated a Sinatra-based app with Devise before.
Thanks,
Hi!
In my scenario I have 3 beanstalkd instances.
When I try to delete some message, I get this error:
Response failed with: NOT_FOUND
It seems that beanstalkd_view is always trying to delete the message from the 1st server.
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- thin (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in
require'
from /var/lib/gems/1.9.1/gems/backports-3.6.5/lib/backports/std_lib.rb:9:in require_with_backports' from /var/lib/gems/1.9.1/gems/rack-1.6.4/lib/rack/handler/thin.rb:1:in
<top (required)>'
from /var/lib/gems/1.9.1/gems/vegas-0.1.11/lib/vegas/runner.rb:295:in setup_rack_handler' from /var/lib/gems/1.9.1/gems/vegas-0.1.11/lib/vegas/runner.rb:36:in
initialize'
from /var/lib/gems/1.9.1/gems/beanstalkd_view-2.0.0/bin/beanstalkd_view:15:in new' from /var/lib/gems/1.9.1/gems/beanstalkd_view-2.0.0/bin/beanstalkd_view:15:in
<top (required)>'
from /usr/local/bin/beanstalkd_view:23:in load' from /usr/local/bin/beanstalkd_view:23:in
After gem installing I got the above error when trying to run it. I installed "thin" via gem and it fixed the problem but this means there is a dependency missing in your project or one you depend on.
A connection error occured after I stopped beanstalkd. This is correct behavior.
But an error occured again after I restart beanstalkd because Beaneater::Pool ojbect is close and not reconnect.
I want to access again without restarting server.
so I'm using bundle exec beanstalkd_view
and I get this error:
/Users/jerrygreen/.rvm/gems/ruby-2.5.0/gems/backports-2.8.2/lib/backports/1.8.7/fixnum.rb:1: warning: constant ::Fixnum is deprecated
/Users/jerrygreen/.rvm/gems/ruby-2.5.0/gems/backports-2.8.2/lib/backports/1.8.7/float.rb:1: warning: constant ::Fixnum is deprecated
[2018-06-06 19:05:55 +0500] Starting 'Beanstalkd View'...
[2018-06-06 19:05:55 +0500] trying port 5678...
Traceback (most recent call last):
24: from /Users/jerrygreen/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `<main>'
23: from /Users/jerrygreen/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `eval'
22: from /Users/jerrygreen/.rvm/gems/ruby-2.5.0/bin/beanstalkd_view:23:in `<main>'
21: from /Users/jerrygreen/.rvm/gems/ruby-2.5.0/bin/beanstalkd_view:23:in `load'
20: from /Users/jerrygreen/.rvm/gems/ruby-2.5.0/gems/beanstalkd_view-2.0.0/bin/beanstalkd_view:15:in `<top (required)>'
19: from /Users/jerrygreen/.rvm/gems/ruby-2.5.0/gems/beanstalkd_view-2.0.0/bin/beanstalkd_view:15:in `new'
18: from /Users/jerrygreen/.rvm/gems/ruby-2.5.0/gems/vegas-0.1.11/lib/vegas/runner.rb:77:in `initialize'
17: from /Users/jerrygreen/.rvm/gems/ruby-2.5.0/gems/vegas-0.1.11/lib/vegas/runner.rb:109:in `start'
16: from /Users/jerrygreen/.rvm/gems/ruby-2.5.0/gems/vegas-0.1.11/lib/vegas/runner.rb:132:in `find_port'
15: from /Users/jerrygreen/.rvm/gems/ruby-2.5.0/gems/vegas-0.1.11/lib/vegas/runner.rb:146:in `port_open?'
14: from /Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/open-uri.rb:35:in `open'
13: from /Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/open-uri.rb:735:in `open'
12: from /Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/open-uri.rb:165:in `open_uri'
11: from /Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/open-uri.rb:224:in `open_loop'
10: from /Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/open-uri.rb:224:in `catch'
9: from /Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/open-uri.rb:226:in `block in open_loop'
8: from /Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/open-uri.rb:755:in `buffer_open'
7: from /Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/open-uri.rb:337:in `open_http'
6: from /Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/net/http.rb:909:in `start'
5: from /Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/net/http.rb:920:in `do_start'
4: from /Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/net/http.rb:935:in `connect'
3: from /Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/timeout.rb:103:in `timeout'
2: from /Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/timeout.rb:93:in `block in timeout'
1: from /Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/net/http.rb:936:in `block in connect'
/Users/jerrygreen/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/net/http.rb:939:in `rescue in block in connect': Failed to open TCP connection to 0.0.0.0:5678 (undefined method `[]' for nil:NilClass) (NoMethodError)
I'm not sure where's the problem. I tried other ports, same error.
is this intended to use with rails api?
Maybe 2.5.0 ruby not supported?
Any suggestions?
Hallo, I have implemented simple view for list of jobs, think about bringing it to your gem. Are you potentially interesting in it, should I try or not?
Thanks for this work.
I had a lot of trouble trying to start the command-line server pointing at anything but my local beanstalkd instance. Looking in the file:
https://github.com/denniskuczynski/beanstalkd_view/blob/master/bin/beanstalkd_view
it appears that the environment variable for controlling the target is forced (on line 12 currently). Simply replacing the line as follows:
ENV['BEANSTALK_URL'] ||= 'beanstalk://localhost/'
allowed me to use environment variables as I had expected from the documentation. I will put that in a Pull Request shortly.
Application in Dockerfile is not working, after building docker image, beanstalkd_view
is not working:
root@ee266c29ff12:/# beanstalkd_view --foreground --no-launch
/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': /var/lib/gems/1.8/gems/beaneater-1.0.0/lib/beaneater/connection.rb:176: syntax error, unexpected ':', expecting ')' (SyntaxError)
transmit("watch #{t}", init: false)
^
/var/lib/gems/1.8/gems/beaneater-1.0.0/lib/beaneater/connection.rb:180: syntax error, unexpected ':', expecting ')'
...smit("use #{tube_used}", init: false) if @tube_used != 'defa...
^
/var/lib/gems/1.8/gems/beaneater-1.0.0/lib/beaneater/connection.rb:242: syntax error, unexpected $end, expecting kEND
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require_without_backports'
from /var/lib/gems/1.8/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require'
from /var/lib/gems/1.8/gems/beaneater-1.0.0/lib/beaneater.rb:4
from /var/lib/gems/1.8/gems/beaneater-1.0.0/lib/beaneater.rb:3:in `each'
from /var/lib/gems/1.8/gems/beaneater-1.0.0/lib/beaneater.rb:3
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require_without_backports'
from /var/lib/gems/1.8/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require'
from /var/lib/gems/1.8/gems/beanstalkd_view-2.0.0/lib/beanstalkd_view.rb:5
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.8/gems/beanstalkd_view-2.0.0/bin/beanstalkd_view:10
from /usr/local/bin/beanstalkd_view:23:in `load'
from /usr/local/bin/beanstalkd_view:23
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.