legion 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/legion_demo +23 -0
- data/lib/legion/version.rb +1 -1
- metadata +5 -5
- data/test/example.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9997b757982e1c3180cecfd0b0f0170deaa963c9
|
4
|
+
data.tar.gz: f216792e4f445b14b818370e5db8a00cdab735bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad7fe05221635026a6935e2278323e4a33e662f69d2a9fdcaa39d3052ef5e844d5ae2d2a69f2f9f6794c5c91551a8d2ccec1413a63b5b1559c889780bf878b60
|
7
|
+
data.tar.gz: 55906773a619d48e87e52c18fc438fe2609f7d93a9aa41fc74c6c76f2324c392e04fd1589eff774ad96650d833273e62e307f997d4bea55a562ac629313fbbd6
|
data/bin/legion_demo
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby --
|
2
|
+
|
3
|
+
require "legion"
|
4
|
+
|
5
|
+
class Example < Legion::Object
|
6
|
+
before(:work) { puts "before hook invoked" }
|
7
|
+
|
8
|
+
def work(index)
|
9
|
+
puts "working on: #{index} ... sleeping for 2 seconds"
|
10
|
+
sleep 2
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def run_example
|
15
|
+
puts "Starting 4 processes to run the demo."
|
16
|
+
supervisor = Legion::Supervisor.new(Example, processes: 4, port: 52042)
|
17
|
+
supervisor.start
|
18
|
+
1000.times { |i| supervisor.work(i) }
|
19
|
+
supervisor.stop
|
20
|
+
end
|
21
|
+
|
22
|
+
run_example
|
23
|
+
|
data/lib/legion/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: legion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Hopkins
|
@@ -41,7 +41,8 @@ dependencies:
|
|
41
41
|
description: Concurrent processing made easy... even for MRI.
|
42
42
|
email:
|
43
43
|
- natehop@gmail.com
|
44
|
-
executables:
|
44
|
+
executables:
|
45
|
+
- legion_demo
|
45
46
|
extensions: []
|
46
47
|
extra_rdoc_files: []
|
47
48
|
files:
|
@@ -49,7 +50,7 @@ files:
|
|
49
50
|
- lib/legion/supervisor.rb
|
50
51
|
- lib/legion/version.rb
|
51
52
|
- lib/legion.rb
|
52
|
-
-
|
53
|
+
- bin/legion_demo
|
53
54
|
homepage: https://github.com/hopsoft/legion
|
54
55
|
licenses:
|
55
56
|
- MIT
|
@@ -74,6 +75,5 @@ rubygems_version: 2.0.3
|
|
74
75
|
signing_key:
|
75
76
|
specification_version: 4
|
76
77
|
summary: Concurrent processing made easy... even for MRI.
|
77
|
-
test_files:
|
78
|
-
- test/example.rb
|
78
|
+
test_files: []
|
79
79
|
has_rdoc:
|
data/test/example.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require_relative "../lib/legion"
|
2
|
-
|
3
|
-
class Example < Legion::Object
|
4
|
-
before(:work) { puts "before work" }
|
5
|
-
|
6
|
-
def work(index)
|
7
|
-
puts "working on: #{index}"
|
8
|
-
sleep 2
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def run_example
|
13
|
-
supervisor = Legion::Supervisor.new(Example, processes: 7, port: 52042)
|
14
|
-
supervisor.start
|
15
|
-
1000.times { |i| supervisor.work(i) }
|
16
|
-
supervisor.stop
|
17
|
-
end
|
18
|
-
|
19
|
-
run_example
|
20
|
-
|