beanstalk-admin 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ #beanstalk-admin
2
+
data/bin/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "beanstalk-client"
4
+
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "beanstalk-client"
4
+
5
+ verbose = ARGV.length > 0 && ARGV[0] == "-v"
6
+
7
+ host = 'localhost:11300'
8
+ beanstalk = Beanstalk::Pool.new([host])
9
+
10
+ beanstalk.list_tubes[host].each do |name|
11
+ tubeStats = beanstalk.stats_tube(name)
12
+ puts name + "(" + tubeStats["current-jobs-ready"].to_s + ")"
13
+ if verbose == true then
14
+ puts tubeStats
15
+ end
16
+ end
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "beanstalk-client"
4
+
5
+ if ARGV.length == 1 then
6
+ queueName = ARGV[0]
7
+ index = 1
8
+ elsif ARGV.length == 2 then
9
+ queueName = ARGV[0]
10
+ index = ARGV[1].to_i
11
+ else
12
+ abort( "Usage: beanstalk-admin-purge <queue name> [index]" )
13
+ end
14
+
15
+
16
+ beanstalk = Beanstalk::Pool.new(['localhost:11300'])
17
+ jobList = Array.new
18
+ begin
19
+ beanstalk.watch(queueName)
20
+ 1.upto(index) do
21
+ job = beanstalk.reserve 1
22
+ jobList << job
23
+ end
24
+ puts jobList.last.body
25
+ rescue Exception => e
26
+ if e.message == "TIMED_OUT" then
27
+ puts "Timeout"
28
+ else
29
+ raise
30
+ end
31
+ end
32
+
33
+ jobList.each do |job|
34
+ job.release
35
+ end
36
+
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "amqp"
4
+
5
+ if ARGV.length != 1 then
6
+ abort( "Usage: beanstalk-admin-purge <queue name>" )
7
+ end
8
+ queueName = ARGV[0]
9
+
10
+ require "beanstalk-client"
11
+
12
+ if ARGV.length == 1 then
13
+ queueName = ARGV[0]
14
+ index = 1
15
+ else
16
+ abort( "Usage: PurgeQueueByName <queue name>" )
17
+ end
18
+
19
+
20
+ beanstalk = Beanstalk::Pool.new(['localhost:11300'])
21
+ begin
22
+ beanstalk.watch(queueName)
23
+ loop do
24
+ job = beanstalk.reserve 1
25
+ job.delete
26
+ end
27
+ rescue Exception => e
28
+ if e.message == "TIMED_OUT" then
29
+ else
30
+ raise
31
+ end
32
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: beanstalk-admin
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Guy Irvine
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-19 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: A number of administration tools for working with beanstalk tubes
15
+ email: guy@guyirvine.com
16
+ executables:
17
+ - beanstalk-admin-list
18
+ - beanstalk-admin-peek
19
+ - beanstalk-admin-purge
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - bin/beanstalk-admin-list
24
+ - bin/beanstalk-admin-peek
25
+ - bin/beanstalk-admin-purge
26
+ - bin/Gemfile
27
+ - README.md
28
+ homepage: http://rubygems.org/gems/beanstalk-admin
29
+ licenses: []
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ requirements: []
47
+ rubyforge_project:
48
+ rubygems_version: 1.8.11
49
+ signing_key:
50
+ specification_version: 3
51
+ summary: Admin tools while running beanstalk
52
+ test_files: []