sshkit-custom-dsl 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df9d3b3f6a8a1e8f438527d2fa787c935d0aec37
4
- data.tar.gz: 7d674c1c4ddfd58e581d78397bbac4c1058593fd
3
+ metadata.gz: 4169122b55f14b75766da7f8c272970350df7b5f
4
+ data.tar.gz: 7cac65991001f7ee3a96e9840ac9a4a3b92f0fbd
5
5
  SHA512:
6
- metadata.gz: ba0cdea9ea03e9050e98048fe550d61411267077cbec690d84489e672e6ca212bcd8eadf6403eae4e46c25963aa8b4c0361e708b76b3f252ce378cfbb0bc2aca
7
- data.tar.gz: cc05b1582649595794fa865511779466fd0661ecb1bd264d0a853a430d212a0424cc54f4028048996ea7d5e5b6d94600cd2e842608542d12ae489b09cc685ded
6
+ metadata.gz: 18f11afcc1ad1deb774afe002b79aaa3b7bd0099562227cb8c1e703e0540ab0ff56e6639ca7ce3fded26281041f339503944cb226b8bb65165c1f8878407ff08
7
+ data.tar.gz: c6d37e3843b43514c8695cd8df04dabfb9e9f08aebb00b504437ea9a15f137f3e1054010564068c87ac17f1f2a8492a1a36b1287fab75601b86a01905982f693
@@ -77,7 +77,7 @@ module SSHKit
77
77
 
78
78
  rescue Exception => e
79
79
  e2 = ExecuteError.new e
80
- raise e2, "Exception while executing on host #{backend}: #{e.message}"
80
+ raise e2, "Exception while executing on host #{backend.host}: #{e.message}"
81
81
  ensure
82
82
  self.active_backend = nil
83
83
  end
@@ -21,7 +21,7 @@ module SSHKit
21
21
 
22
22
 
23
23
  def group_size
24
- @group_size || options[:limit] || 2
24
+ @group_size ||= options[:limit] || 2
25
25
  end
26
26
 
27
27
  end
@@ -3,20 +3,29 @@ module SSHKit
3
3
  module Config
4
4
  module Runner
5
5
 
6
+ require 'rake'
7
+
6
8
  class Parallel < Abstract
7
9
 
8
- def apply_block_to_bcks(&block)
9
- threads = []
10
10
 
11
- backends.each do |next_backend|
12
11
 
13
- threads << Thread.new(next_backend) do |backend|
14
- apply_to_bck backend, &block
15
- end
12
+ def thread_pool
13
+ @thread_pool ||= Rake::ThreadPool.new(thread_count)
14
+ end
16
15
 
16
+ def apply_block_to_bcks(&block)
17
+
18
+ futures = backends.map do |b|
19
+ thread_pool.future(b) do |fb|
20
+ apply_to_bck fb, &block
21
+ end
17
22
  end
18
23
 
19
- threads.map(&:join)
24
+ futures.each { |f| f.value }
25
+ end
26
+
27
+ def thread_count
28
+ @thread_count ||= options[:thread_count] || Rake.suggested_thread_count-1
20
29
  end
21
30
 
22
31
  end
@@ -1,7 +1,7 @@
1
1
  module SSHKit
2
2
  module Custom
3
3
  module DSL
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
6
6
  end
7
7
  end
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency 'sshkit', '~> 1.5.1'
22
22
  spec.add_dependency 'scoped_storage'
23
+ spec.add_dependency 'rake'
23
24
 
24
25
  spec.add_development_dependency "bundler"
25
- spec.add_development_dependency "rake"
26
26
  spec.add_development_dependency "rspec"
27
27
 
28
28
  spec.add_development_dependency 'rspec', '2.99.0.rc1'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sshkit-custom-dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dieter Späth
@@ -39,13 +39,13 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
- type: :development
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '>='