beanstalk-admin 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/beanstalk-admin-dump +36 -0
- data/bin/beanstalk-admin-load +29 -0
- data/bin/beanstalk-admin-purge +1 -3
- metadata +7 -2
@@ -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
|
+
else
|
8
|
+
abort( "Usage: beanstalk-admin-dump <queue name>" )
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
beanstalk = Beanstalk::Pool.new(['localhost:11300'])
|
13
|
+
jobList = Array.new
|
14
|
+
bodyList = Array.new
|
15
|
+
begin
|
16
|
+
tubeStats = beanstalk.stats_tube(queueName)
|
17
|
+
count = tubeStats["current-jobs-ready"].to_i
|
18
|
+
|
19
|
+
beanstalk.watch(queueName)
|
20
|
+
1.upto(count) do
|
21
|
+
job = beanstalk.reserve 1
|
22
|
+
jobList << job
|
23
|
+
bodyList << job.body
|
24
|
+
end
|
25
|
+
rescue Exception => e
|
26
|
+
if e.message == "TIMED_OUT" then
|
27
|
+
puts "Timeout"
|
28
|
+
else
|
29
|
+
raise
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
puts YAML::dump(bodyList)
|
34
|
+
jobList.each do |job|
|
35
|
+
job.release
|
36
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "beanstalk-client"
|
4
|
+
|
5
|
+
if ARGV.length == 1 then
|
6
|
+
queueName = ARGV[0]
|
7
|
+
else
|
8
|
+
abort( "Usage: cat <filename> | beanstalk-admin-load <queue name>" )
|
9
|
+
end
|
10
|
+
|
11
|
+
content = STDIN.read
|
12
|
+
list = YAML::load(content)
|
13
|
+
|
14
|
+
beanstalk = Beanstalk::Pool.new(['localhost:11300'])
|
15
|
+
begin
|
16
|
+
beanstalk.use(queueName)
|
17
|
+
list.each do |msg|
|
18
|
+
beanstalk.put msg
|
19
|
+
end
|
20
|
+
|
21
|
+
rescue Exception => e
|
22
|
+
if e.message == "TIMED_OUT" then
|
23
|
+
puts "Timeout"
|
24
|
+
else
|
25
|
+
raise
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
puts "#{list.length} msgs loaded to queue: #{queueName}"
|
data/bin/beanstalk-admin-purge
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "beanstalk-client"
|
4
4
|
|
5
5
|
if ARGV.length != 1 then
|
6
6
|
abort( "Usage: beanstalk-admin-purge <queue name>" )
|
7
7
|
end
|
8
8
|
queueName = ARGV[0]
|
9
9
|
|
10
|
-
require "beanstalk-client"
|
11
|
-
|
12
10
|
if ARGV.length == 1 then
|
13
11
|
queueName = ARGV[0]
|
14
12
|
index = 1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beanstalk-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-20 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A number of administration tools for working with beanstalk tubes
|
15
15
|
email: guy@guyirvine.com
|
@@ -17,10 +17,14 @@ executables:
|
|
17
17
|
- beanstalk-admin-list
|
18
18
|
- beanstalk-admin-peek
|
19
19
|
- beanstalk-admin-purge
|
20
|
+
- beanstalk-admin-dump
|
21
|
+
- beanstalk-admin-load
|
20
22
|
extensions: []
|
21
23
|
extra_rdoc_files: []
|
22
24
|
files:
|
25
|
+
- bin/beanstalk-admin-dump
|
23
26
|
- bin/beanstalk-admin-list
|
27
|
+
- bin/beanstalk-admin-load
|
24
28
|
- bin/beanstalk-admin-peek
|
25
29
|
- bin/beanstalk-admin-purge
|
26
30
|
- bin/Gemfile
|
@@ -50,3 +54,4 @@ signing_key:
|
|
50
54
|
specification_version: 3
|
51
55
|
summary: Admin tools while running beanstalk
|
52
56
|
test_files: []
|
57
|
+
has_rdoc:
|