mattmatt-cap-ext-parallelize 0.1.1 → 0.1.2

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 CHANGED
@@ -37,6 +37,14 @@ If one of your tasks ran in a transaction block and issued a rollback,
37
37
  parallelize will rollback all other threads, if they have rollback statements
38
38
  defined.
39
39
 
40
+ Known Issues
41
+ ============
42
+
43
+ Due to the threading you have to be sure to already have authenticated your SSH
44
+ key (you're using SSH keys, right?) using an SSH agent before you run the
45
+ parallelized code. Otherwise it'll blow up, let's just leave it at that. That'll
46
+ change in the future.
47
+
40
48
  Installation
41
49
  ============
42
50
 
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 1
3
- :patch: 1
3
+ :patch: 2
4
4
  :major: 0
@@ -3,6 +3,7 @@ module Capistrano
3
3
  module Extensions
4
4
  module Actions
5
5
  module Invocation
6
+
6
7
  class BlockProxy
7
8
  attr_accessor :blocks
8
9
 
@@ -22,7 +23,6 @@ module Capistrano
22
23
  yield proxy
23
24
 
24
25
  logger.info "Running #{proxy.blocks.size} threads in chunks of #{thread_count || parallelize_thread_count}"
25
-
26
26
  run_parallelize_loop(proxy, thread_count || parallelize_thread_count)
27
27
  end
28
28
 
@@ -60,6 +60,7 @@ module Capistrano
60
60
  thread.join
61
61
  rescue
62
62
  logger.important "Subthread failed: #{$!.message}"
63
+ thread[:exception_raised] = $!
63
64
  end
64
65
  end
65
66
  end
@@ -1,6 +1,7 @@
1
1
  module Capistrano
2
2
  class Configuration
3
3
  module Extensions
4
+
4
5
  # Thread-safe(r) version of the Capistrano default
5
6
  # connection handling.
6
7
  module Connections
@@ -49,6 +50,7 @@ module Capistrano
49
50
  raise unless failures
50
51
  failures << { :server => server, :error => err }
51
52
  end
53
+
52
54
  end
53
55
  end
54
56
  end
@@ -2,6 +2,7 @@ module Capistrano
2
2
  class Configuration
3
3
  module Extensions
4
4
  module Execution
5
+
5
6
  def task_call_frames
6
7
  Thread.current[:task_call_frames] ||= []
7
8
  end
@@ -20,18 +21,28 @@ module Capistrano
20
21
  all_task_call_frames.last.task
21
22
  end
22
23
 
23
- def transaction
24
+ def transaction?
25
+ !(rollback_requests.nil? && Thread.main[:rollback_requests].nil?)
26
+ end
27
+
28
+ def transaction(&blk)
24
29
  super do
25
30
  self.rollback_requests = [] unless transaction?
26
- yield
31
+ blk.call
27
32
  end
28
33
  end
29
34
 
35
+ def on_rollback(&block)
36
+ self.rollback_requests ||= [] if transaction?
37
+ super
38
+ end
39
+
30
40
  def rollback!
31
- return if Thread.current[:rollback_requests].nil?
32
- Thread.current[:rolled_back] = true
41
+ return if rollback_requests.nil?
33
42
  super
43
+ Thread.current[:rolled_back] = true
34
44
  end
45
+
35
46
  end
36
47
  end
37
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mattmatt-cap-ext-parallelize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathias Meyer
@@ -39,7 +39,6 @@ files:
39
39
  - lib/capistrano/configuration
40
40
  - lib/capistrano/configuration/extensions
41
41
  - lib/capistrano/configuration/extensions/actions
42
- - lib/capistrano/configuration/extensions/actions/extensions
43
42
  - lib/capistrano/configuration/extensions/actions/invocation.rb
44
43
  - lib/capistrano/configuration/extensions/connections.rb
45
44
  - lib/capistrano/configuration/extensions/execution.rb