resque-sliders 0.2.0 → 0.2.1
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/README.md +16 -15
- data/lib/resque-sliders/commander.rb +1 -2
- data/lib/resque-sliders/server/public/js/sliders.js +9 -5
- data/lib/resque-sliders/version.rb +1 -1
- data/test/kewatcher_test.rb +2 -2
- data/test/redis-test.conf +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -20,6 +20,7 @@ ResqueSliders comes in two parts:
|
|
20
20
|
* `KEWatcher`: A daemon that runs on any machine that needs to run Resque workers, watches over the workers and controls which ones are running
|
21
21
|
* `Resque-Web Plugin`: A bunch of slider bars, with text-input box to specify what queues to run on the workers
|
22
22
|
|
23
|
+
|
23
24
|
Installation
|
24
25
|
------------
|
25
26
|
|
@@ -27,8 +28,8 @@ Install as a gem:
|
|
27
28
|
|
28
29
|
$ gem install resque-sliders
|
29
30
|
|
30
|
-
KEWatcher
|
31
|
-
|
31
|
+
### KEWatcher
|
32
|
+
|
32
33
|
This is the daemon component that runs on any host that you want to run Resque workers on. The daemon's job is to manage **how many** Resque workers should be running, and **what** they should be running. It also provides an easy way to stop all workers during maintenance or deploys.
|
33
34
|
|
34
35
|
When the daemon first runs, it will register itself, by hostname with Redis:
|
@@ -55,7 +56,7 @@ Options:
|
|
55
56
|
-V, --version Prints Version
|
56
57
|
```
|
57
58
|
|
58
|
-
|
59
|
+
#### Important Options
|
59
60
|
|
60
61
|
```
|
61
62
|
-m|--max MAX (Max Children): Maximum number of workers to run on host (default: 10)
|
@@ -68,10 +69,20 @@ Options:
|
|
68
69
|
RAILS_ENV: If you're using rails, you need to set your RAILS_ENV variable
|
69
70
|
```
|
70
71
|
|
71
|
-
|
72
|
+
#### Controlling the Daemon
|
72
73
|
|
73
74
|
Once the daemon is running on each host that is going to run Resque workers, you'll need to tell them which queues to run.
|
74
75
|
|
76
|
+
#### Signals
|
77
|
+
|
78
|
+
KEWatcher supports all the [same signals as Resque](https://github.com/defunkt/resque#signals):
|
79
|
+
|
80
|
+
* `TERM` / `INT` / `QUIT` - Shutdown. Gracefully kill all child Resque workers, and wait for them to finish before exiting
|
81
|
+
* `HUP` - Restart all Resque workers by gracefully killing them, and starting new ones in their place
|
82
|
+
* `USR1` - Stop all Resque workers, and don't start any more
|
83
|
+
* `USR2` - Pause spawning of new queues, but leave current ones running
|
84
|
+
* `CONT` - Unpause. Continue spawning/managing child Resque workers
|
85
|
+
|
75
86
|
The queue configuration is done via Resque-Web interface
|
76
87
|
|
77
88
|
#### Resque-Web
|
@@ -84,19 +95,9 @@ Buttons:
|
|
84
95
|
* `Stop` - Stop all workers
|
85
96
|
* `Reload` - Sends HUP signal to running KEWatcher
|
86
97
|
|
87
|
-
#### Signals
|
88
|
-
|
89
|
-
KEWatcher supports all the [same signals as Resque](https://github.com/defunkt/resque#signals):
|
90
|
-
|
91
|
-
* `TERM` / `INT` / `QUIT` - Shutdown. Gracefully kill all child Resque workers, and wait for them to finish before exiting
|
92
|
-
* `HUP` - Restart all Resque workers by gracefully killing them, and starting new ones in their place
|
93
|
-
* `USR1` - Stop all Resque workers, and don't start any more
|
94
|
-
* `USR2` - Pause spawning of new queues, but leave current ones running
|
95
|
-
* `CONT` - Unpause. Continue spawning/managing child Resque workers
|
96
98
|
|
99
|
+
### Resque-Web Integration
|
97
100
|
|
98
|
-
Resque-Web Integration
|
99
|
-
----------------------
|
100
101
|
**Main Screen:** showing 3 hosts, and showing that one of the nodes is not running KEWatcher
|
101
102
|

|
102
103
|
|
@@ -50,8 +50,7 @@ module Resque
|
|
50
50
|
def change(host, queue, quantity)
|
51
51
|
# queue is sanitized by:
|
52
52
|
# replacing punctuation with spaces, strip end spaces, split on remaining whitespace, and join again on comma.
|
53
|
-
|
54
|
-
queue2 = queue.downcase.gsub(/[^a-z 0-9,_\-\*]/, '').strip.split(/, */).reject {|x| (x.length == 1 and %w(- _).include?(x)) or x.empty? }.join(',')
|
53
|
+
queue2 = queue.gsub(/['":]/, '').strip.gsub(/\s+/, ',').split(/, */).reject { |x| x.nil? or x.empty? }.join(',')
|
55
54
|
raise 'Queue Different' unless queue == queue2
|
56
55
|
redis_set_hash("#{key_prefix}:#{host}", queue2, quantity) unless queue2.empty?
|
57
56
|
end
|
@@ -7,8 +7,10 @@ $(document).ready(function() {
|
|
7
7
|
$("#total").text(total);
|
8
8
|
};
|
9
9
|
function sanitize_input(s) {
|
10
|
-
|
10
|
+
// delete non-friendly chars, replace spaces in words with commas for resque
|
11
|
+
var ary = s.replace(/['":]/g, '').replace(/^\s+|\s+$/g, '').replace(/\s+/g, ',').split(/, */);
|
11
12
|
var new_ary = [];
|
13
|
+
// remove empties from array
|
12
14
|
$.each(ary, function() {
|
13
15
|
if (this != '') {
|
14
16
|
new_ary.push($.trim(this));
|
@@ -57,10 +59,12 @@ $(document).ready(function() {
|
|
57
59
|
e.preventDefault();
|
58
60
|
var queue = sanitize_input($("#new_queue").val());
|
59
61
|
var host = $(this).attr("id");
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
62
|
+
if (queue != '') {
|
63
|
+
$.post(host, { quantity: 1, queue: queue }, function(data) {
|
64
|
+
// reload window
|
65
|
+
window.location.reload(true);
|
66
|
+
});
|
67
|
+
}
|
64
68
|
});
|
65
69
|
$("#plus-one").click(function() {
|
66
70
|
$('.new_form').submit();
|
data/test/kewatcher_test.rb
CHANGED
@@ -26,12 +26,12 @@ context "kewatcher" do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
test "kewatcher runs" do
|
29
|
-
`bundle exec kewatcher --config #{@options[:config]} >/dev/null 2>&1 & sleep 3`
|
29
|
+
`(bundle exec kewatcher --config #{@options[:config]}) >/dev/null 2>&1 & sleep 3`
|
30
30
|
assert @kewatcher.running?
|
31
31
|
end
|
32
32
|
|
33
33
|
test "kewatcher wont run twice" do
|
34
|
-
`bundle exec kewatcher --config #{@options[:config]} >/dev/null 2>&1 &`
|
34
|
+
`(bundle exec kewatcher --config #{@options[:config]}) >/dev/null 2>&1 &`
|
35
35
|
sleep 3
|
36
36
|
output = `bundle exec kewatcher --config #{@options[:config]}`
|
37
37
|
assert_match %r{Already running}, output
|
data/test/redis-test.conf
CHANGED
@@ -112,4 +112,4 @@ databases 16
|
|
112
112
|
# Glue small output buffers together in order to send small replies in a
|
113
113
|
# single TCP packet. Uses a bit more CPU but most of the times it is a win
|
114
114
|
# in terms of number of queries per second. Use 'yes' if unsure.
|
115
|
-
glueoutputbuf yes
|
115
|
+
#glueoutputbuf yes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-sliders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
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: 2012-
|
12
|
+
date: 2012-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: resque
|
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
segments:
|
92
92
|
- 0
|
93
|
-
hash:
|
93
|
+
hash: 3990848849096963840
|
94
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
segments:
|
101
101
|
- 0
|
102
|
-
hash:
|
102
|
+
hash: 3990848849096963840
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
105
|
rubygems_version: 1.8.24
|