deadly_serious 2.0.0.pre.rc1 → 2.0.0.pre.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/deadly_serious.gemspec +1 -1
- data/lib/deadly_serious/engine/pipeline.rb +16 -13
- data/lib/deadly_serious/version.rb +1 -1
- data/spec/lib/deadly_serious/engine/channel/socket_channel_spec.rb +4 -3
- data/spec/lib/deadly_serious/engine/pipeline_spec.rb +9 -0
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 674822fd44059d7b252f5083dcbc982f633472b4
|
4
|
+
data.tar.gz: 56612d70f7df34ec08bd9a6ecd795e8d58a17b60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca3933abc30d5f415bc5ac14fd01d93fbfdff61dd1f0e082bb9d1cae4d56f7ab83b3f25380c16ec6623de835079f95a805634a386b533cc598126c18d450a9c7
|
7
|
+
data.tar.gz: e46b9f206e57290d25dc5f9bdb8b8437bdcf085ed51d9be3722b34cd3593d54d09565ec42546238f25f5ab175d9a2131fbb0cb6d6d0439b85c5b50c98b13f02d
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.1
|
data/deadly_serious.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.0'
|
22
22
|
spec.add_development_dependency 'rake', '~> 10.0'
|
23
23
|
spec.add_development_dependency 'pry', '~> 0.10'
|
24
|
-
spec.add_development_dependency 'guard-rspec', '~> 4.
|
24
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.6', '>= 4.6.4'
|
25
25
|
|
26
26
|
spec.add_dependency 'oj', '~> 2.0'
|
27
27
|
spec.add_dependency 'multi_json', '~> 1.0'
|
@@ -10,7 +10,9 @@ module DeadlySerious
|
|
10
10
|
preserve_pipe_dir: false,
|
11
11
|
&block)
|
12
12
|
|
13
|
-
@config = Config.new(data_dir: data_dir,
|
13
|
+
@config = DeadlySerious::Engine::Config.new(data_dir: data_dir,
|
14
|
+
pipe_dir: pipe_dir,
|
15
|
+
preserve_pipe_dir: preserve_pipe_dir)
|
14
16
|
@block = block
|
15
17
|
@pids = []
|
16
18
|
end
|
@@ -19,9 +21,9 @@ module DeadlySerious
|
|
19
21
|
@config.setup
|
20
22
|
@block.call(self)
|
21
23
|
wait_children
|
22
|
-
rescue
|
23
|
-
|
24
|
-
raise
|
24
|
+
rescue
|
25
|
+
clean_suicide
|
26
|
+
raise
|
25
27
|
ensure
|
26
28
|
@config.teardown if @config
|
27
29
|
end
|
@@ -78,21 +80,22 @@ module DeadlySerious
|
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
83
|
+
def clean_suicide
|
84
|
+
@pids ||= [] # Avoid stupid errors
|
85
|
+
@pids.each { |pid| Process.kill('SIGTERM', pid) rescue nil }
|
86
|
+
Timeout::timeout(5) { wait_children }
|
87
|
+
rescue Timeout::Error
|
88
|
+
@pids.each { |pid| Process.kill('SIGKILL', pid) rescue nil }
|
89
|
+
ensure
|
90
|
+
@pids.clear
|
91
|
+
end
|
92
|
+
|
81
93
|
private
|
82
94
|
|
83
95
|
def wait_children
|
84
96
|
Process.waitall
|
85
97
|
end
|
86
98
|
|
87
|
-
def kill_children
|
88
|
-
gpid = Process.gid
|
89
|
-
Process.kill('SIGTERM', -gpid) rescue nil
|
90
|
-
Timeout::timeout(5) { wait_children }
|
91
|
-
@pids.clear
|
92
|
-
rescue Timeout::Error
|
93
|
-
Process.kill('SIGKILL', -gpid) rescue nil
|
94
|
-
end
|
95
|
-
|
96
99
|
def set_process_name(name)
|
97
100
|
$0 = name
|
98
101
|
end
|
@@ -3,9 +3,10 @@ include DeadlySerious::Engine
|
|
3
3
|
|
4
4
|
describe SocketChannel do
|
5
5
|
let(:test_config) do
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
# Conflicts with RbConfig in < 2.1
|
7
|
+
DeadlySerious::Engine::Config.new(data_dir: "/tmp/test_deadly_serious#{Process.pid}",
|
8
|
+
pipe_dir: "/tmp/test_deadly_serious#{Process.pid}",
|
9
|
+
preserve_pipe_dir: false)
|
9
10
|
end
|
10
11
|
|
11
12
|
matcher :produce_a do |expected|
|
@@ -72,6 +72,15 @@ describe Pipeline do
|
|
72
72
|
expect(finish - start).to be >= DELAY
|
73
73
|
end
|
74
74
|
|
75
|
+
it 'kills children' do
|
76
|
+
pipeline = Pipeline.new do |p|
|
77
|
+
p.spawn_process(TestComponentTime, DELAY)
|
78
|
+
p.clean_suicide
|
79
|
+
p.spawn_process(TestComponentTime, DELAY)
|
80
|
+
end
|
81
|
+
expect { pipeline.run }.not_to raise_error
|
82
|
+
end
|
83
|
+
|
75
84
|
it 'spawns children in parallel' do
|
76
85
|
pipeline = Pipeline.new do |p|
|
77
86
|
p.spawn_process(TestComponentTime, DELAY)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deadly_serious
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.pre.
|
4
|
+
version: 2.0.0.pre.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ronie Uliana
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,14 +58,20 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '4.
|
61
|
+
version: '4.6'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 4.6.4
|
62
65
|
type: :development
|
63
66
|
prerelease: false
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
65
68
|
requirements:
|
66
69
|
- - "~>"
|
67
70
|
- !ruby/object:Gem::Version
|
68
|
-
version: '4.
|
71
|
+
version: '4.6'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 4.6.4
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: oj
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|