sponges 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -22
- data/lib/sponges/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0cac568a3c8a62e54982cfc0f148a3364ce621d
|
4
|
+
data.tar.gz: b43a3a61760b50152a5822530f40164cc3a8929d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03fc14026327a11541b3c6e64e2ace1589ef4082e99db43c3d37058ffc603a6e4639606c3cffc5ea1c8a14694183ccd753e1d6a619a24141884732bde5440dff
|
7
|
+
data.tar.gz: 21798560537ad2d3cded92ee268586a476eff76dceffd7746b7c74719dee87db4568e14a577205b276edc7aa12d8cccb7e13fefb672da6a48700948cb56ae95e
|
data/README.md
CHANGED
@@ -5,20 +5,19 @@ Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/AF83
|
|
5
5
|
[![Gem
|
6
6
|
Version](https://fury-badge.herokuapp.com/rb/sponges.png)](http://badge.fury.io/rb/sponges)
|
7
7
|
|
8
|
-
When I build workers, I want them to be like an army of spongebobs
|
9
|
-
stressed and eager to work. `sponges` helps you
|
10
|
-
|
11
|
-
to work
|
8
|
+
When I build workers, I want them to be much like an army of spongebobs: always
|
9
|
+
stressed and eager to work. `sponges` helps you with building this army of sponges,
|
10
|
+
controling them, and, well, eventually killing them gracefully. Hum, making them
|
11
|
+
stressed and eager to work would still be your job :)
|
12
12
|
|
13
13
|
Basically, sponges is a ruby supervisor that forks processes and controls their
|
14
|
-
execution and termination. For example the following will start a supervision
|
15
|
-
daemon and 8 processes of
|
14
|
+
execution and termination. For example, the following will start a supervision
|
15
|
+
daemon and 8 processes of "a_worker":
|
16
16
|
|
17
17
|
```bash
|
18
18
|
ruby a_worker.rb start -d -s 8
|
19
19
|
```
|
20
|
-
If you kill the supervisor it will cleanly
|
21
|
-
terminate the child processes.
|
20
|
+
If you kill the supervisor, it will cleanly terminate its child processes.
|
22
21
|
|
23
22
|
Internally, `sponges` strongly relies on Unix signals.
|
24
23
|
|
@@ -28,19 +27,22 @@ Internally, `sponges` strongly relies on Unix signals.
|
|
28
27
|
|
29
28
|
## Installation
|
30
29
|
|
31
|
-
Ruby 1.9.2
|
30
|
+
Requires Ruby 1.9.2 or newer.
|
32
31
|
|
33
32
|
Install it with rubygems:
|
34
33
|
|
35
34
|
gem install sponges
|
36
35
|
|
37
|
-
|
36
|
+
You may use bundler. In this case, add it to your `Gemfile`:
|
38
37
|
|
39
38
|
``` ruby
|
40
39
|
gem "sponges"
|
41
40
|
```
|
42
41
|
|
42
|
+
and run `bundle install`.
|
43
|
+
|
43
44
|
## Usage
|
45
|
+
|
44
46
|
In a file called `example.rb`:
|
45
47
|
|
46
48
|
``` ruby
|
@@ -127,35 +129,31 @@ Stop workers with a `HUP` signal :
|
|
127
129
|
``` bash
|
128
130
|
ruby example.rb stop -g -t 5
|
129
131
|
```
|
132
|
+
|
130
133
|
In this case, you will have to trap the `HUP` signal, and handle a clean stop
|
131
134
|
from each workers. The point is to wait for a task to be done before quitting. A
|
132
|
-
timeout can be specify with the `-t` option. When this timeout is
|
135
|
+
timeout can be specify with the `-t` option. When this timeout is hit, the
|
133
136
|
process is killed.
|
134
137
|
|
135
138
|
Increment worker's pool size :
|
136
139
|
``` bash
|
137
|
-
ruby example.rb increment # will add a worker
|
140
|
+
ruby example.rb increment # will add a worker from the pool.
|
138
141
|
```
|
139
142
|
|
140
143
|
Decrement worker's pool size :
|
141
144
|
``` bash
|
142
|
-
ruby example.rb decrement # will remove a worker
|
143
|
-
```
|
144
|
-
|
145
|
-
Show a list of workers and their children.
|
146
|
-
``` bash
|
147
|
-
ruby example.rb list
|
145
|
+
ruby example.rb decrement # will remove a worker from the pool.
|
148
146
|
```
|
149
147
|
|
150
|
-
##
|
148
|
+
## HTTP supervision
|
151
149
|
|
152
|
-
sponges provides an
|
153
|
-
pids.
|
150
|
+
sponges provides an HTTP interface to supervise the pool's activity, and to expose
|
151
|
+
pids. HTTP supervision can be enabled in the configuration:
|
154
152
|
|
155
153
|
|
156
154
|
``` ruby
|
157
155
|
Sponges.configure do |config|
|
158
|
-
config.port
|
156
|
+
config.port = 3333
|
159
157
|
end
|
160
158
|
```
|
161
159
|
|
data/lib/sponges/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sponges
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chatgris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: boson
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0
|
33
|
+
version: 0.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0
|
40
|
+
version: 0.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,3 +99,4 @@ signing_key:
|
|
99
99
|
specification_version: 4
|
100
100
|
summary: Turn any ruby object to a daemon controlling an army of sponges.
|
101
101
|
test_files: []
|
102
|
+
has_rdoc:
|