capistrano_multiconfig_parallel 0.8.2 → 0.8.3

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: d6134462591dad203c8813ee2541c18ac6130a28
4
- data.tar.gz: 1d05c54dac21aaab77ac4b1aaf23aa6bf022ae5d
3
+ metadata.gz: b20d2ee84ec2ed3ed429a379cfed127acc0aeb88
4
+ data.tar.gz: b18344f2beaadc2e8471ae5a8b974853e912e59b
5
5
  SHA512:
6
- metadata.gz: f2219e649e4124fe1e50590114d12206ebb5de565bfa7ef20a48bc142ae0ab27402269d19efac9af8b77136688f3cbdb3b79524fc49e3f518d9e7781847d8bb6
7
- data.tar.gz: 76887f9b98ddd6ad97185111d8f83946ff8d72a0ba656bd1fb8c0cfe09d9d710892a5fe260737008efc22df37a56b54374af8327ff5cd2a032ac79daedea9d6c
6
+ metadata.gz: 609aba7897211c50b8c2877c677b1a94d24f10c8a829317d4a63ba47162603f139b3a848b1a9cdb806c830871ef35fae423df7bc391317973ca7cf0911c93dee
7
+ data.tar.gz: c0c38bf78cf472833d5dc49f704627ce2c04dd9ac29788c1ff2eb65efa9d685dbb752db470ba82e38866d7376460a850bc0c805aa86247fc1bfbb2a62752c048
@@ -229,7 +229,7 @@ module CapistranoMulticonfigParallel
229
229
  return unless @execute_deploy
230
230
  if exit_status.exitstatus != 0
231
231
  debug("worker #{job_id} tries to terminate") if debug_enabled?
232
- raise(CapistranoMulticonfigParallel::CelluloidWorker::TaskFailed, "task #{@action} failed ") # force worker to rollback
232
+ raise(CapistranoMulticonfigParallel::CelluloidWorker::TaskFailed, "task failed with exit status #{exit_status.inspect} ") # force worker to rollback
233
233
  else
234
234
  update_machine_state('FINISHED')
235
235
  debug("worker #{job_id} notifies manager has finished") if debug_enabled?
@@ -4,13 +4,15 @@ module CapistranoMulticonfigParallel
4
4
  include Celluloid
5
5
  include Celluloid::Logger
6
6
 
7
- attr_accessor :actor, :pid, :exit_status, :process, :filename, :worker_log
7
+ attr_accessor :actor, :pid, :exit_status, :process, :filename, :worker_log, :job_id, :debug_enabled
8
8
 
9
9
  finalizer :process_finalizer
10
10
 
11
11
  def work(cmd, options = {})
12
12
  @options = options
13
13
  @actor = @options.fetch(:actor, nil)
14
+ @job_id = @actor.job_id
15
+ @debug_enabled = @actor.debug_enabled?
14
16
  set_worker_log
15
17
  EM.run do
16
18
  EM.next_tick do
@@ -21,8 +23,8 @@ module CapistranoMulticonfigParallel
21
23
  end
22
24
  end
23
25
  EM.error_handler do|e|
24
- puts "Error during event loop for worker #{@actor.job_id}: #{e.inspect}" if @actor.debug_enabled?
25
- puts e.backtrace if @actor.debug_enabled?
26
+ @worker_log.debug "Error during event loop for worker #{@job_id}: #{e.inspect}" if @debug_enabled
27
+ @worker_log.debug e.backtrace if @debug_enabled
26
28
  EM.stop
27
29
  end
28
30
  end
@@ -47,10 +49,10 @@ module CapistranoMulticonfigParallel
47
49
  def check_exit_status
48
50
  return unless @exit_status.present?
49
51
  if @options[:dry_run]
50
- debug("worker #{@actor.job_id} starts execute deploy") if @actor.debug_enabled?
52
+ debug("worker #{@actor.job_id} starts execute deploy") if @debug_enabled
51
53
  @actor.async.execute_deploy
52
54
  elsif !@actor.worker_finshed?
53
- debug("worker #{@actor.job_id} startsnotify finished") if @actor.debug_enabled?
55
+ debug("worker #{@actor.job_id} startsnotify finished") if @debug_enabled
54
56
  @actor.notify_finished(@exit_status)
55
57
  end
56
58
  end
@@ -61,6 +63,7 @@ module CapistranoMulticonfigParallel
61
63
  target: self,
62
64
  environment: options[:environment].present? ? options[:environment] : nil,
63
65
  pid_handler: :on_pid,
66
+ input: :on_input_stdin ,
64
67
  stdout_handler: :on_read_stdout,
65
68
  stderr_handler: :on_read_stderr,
66
69
  watch_handler: :watch_handler,
@@ -85,12 +88,12 @@ module CapistranoMulticonfigParallel
85
88
  end
86
89
 
87
90
  def on_exit(status)
88
- debug "Child process for worker #{@actor.job_id} on_exit disconnected due to error #{status.inspect}" if @actor.debug_enabled?
91
+ @worker_log.debug "Child process for worker #{@job_id} on_exit disconnected due to error #{status.inspect}" if @debug_enabled
89
92
  @exit_status = status
90
93
  end
91
94
 
92
95
  def async_exception_handler(*data)
93
- debug "Child process for worker #{@actor.job_id} async_exception_handler disconnected due to error #{data.inspect}" if @actor.debug_enabled?
96
+ @worker_log.debug "Child process for worker #{@job_id} async_exception_handler disconnected due to error #{data.inspect}" if @debug_enabled
94
97
  io_callback('stderr', data)
95
98
  @exit_status = 1
96
99
  end
@@ -98,7 +101,7 @@ module CapistranoMulticonfigParallel
98
101
  def watch_handler(process)
99
102
  @process ||= process
100
103
  end
101
-
104
+
102
105
  def get_question_details(data)
103
106
  question = ''
104
107
  default = nil
@@ -123,7 +126,7 @@ module CapistranoMulticonfigParallel
123
126
 
124
127
  def io_callback(io, data)
125
128
  @worker_log.debug("#{io.upcase} ---- #{data}")
126
- # user_prompt_needed?(data)
129
+ # user_prompt_needed?(data)
127
130
  end
128
131
  end
129
132
  end
@@ -1,3 +1,5 @@
1
+ require 'celluloid/autostart'
2
+ require_relative "../celluloid/rake_worker"
1
3
  module CapistranoMulticonfigParallel
2
4
  class ExtensionHelper
3
5
  class << self
@@ -8,6 +10,7 @@ module CapistranoMulticonfigParallel
8
10
  def job_id
9
11
  ENV[CapistranoMulticonfigParallel::ENV_KEY_JOB_ID]
10
12
  end
13
+
11
14
 
12
15
  def rake_actor_id
13
16
  ENV['count_rake'].present? ? "rake_worker_#{job_id}_count" : "rake_worker_#{job_id}"
@@ -34,7 +37,7 @@ module CapistranoMulticonfigParallel
34
37
  until Celluloid::Actor[rake_actor_id].task_approved
35
38
  Celluloid::Actor[rake_actor_id].wait_execution
36
39
  end
37
- yield if Celluloid::Actor[rake_actor_id].task_approved
40
+ yield Celluloid::Actor[rake_actor_id] if Celluloid::Actor[rake_actor_id].task_approved
38
41
  end
39
42
  end
40
43
  end
@@ -1,4 +1,4 @@
1
- require_relative '../helpers/extension_helper'
1
+ require_relative './extension_helper'
2
2
  Rake::Task.class_eval do
3
3
  alias_method :original_execute, :execute
4
4
 
@@ -8,7 +8,7 @@ module CapistranoMulticonfigParallel
8
8
  module VERSION
9
9
  MAJOR = 0
10
10
  MINOR = 8
11
- TINY = 2
11
+ TINY = 3
12
12
  PRE = nil
13
13
 
14
14
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano_multiconfig_parallel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-09 00:00:00.000000000 Z
11
+ date: 2015-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid-pmap
@@ -646,9 +646,9 @@ files:
646
646
  - lib/capistrano_multiconfig_parallel/celluloid/terminal_table.rb
647
647
  - lib/capistrano_multiconfig_parallel/cli.rb
648
648
  - lib/capistrano_multiconfig_parallel/configuration.rb
649
+ - lib/capistrano_multiconfig_parallel/extensions/extension_helper.rb
649
650
  - lib/capistrano_multiconfig_parallel/extensions/rake.rb
650
651
  - lib/capistrano_multiconfig_parallel/helpers/base_manager.rb
651
- - lib/capistrano_multiconfig_parallel/helpers/extension_helper.rb
652
652
  - lib/capistrano_multiconfig_parallel/helpers/multi_app_manager.rb
653
653
  - lib/capistrano_multiconfig_parallel/helpers/single_app_manager.rb
654
654
  - lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb