einhorn 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
data/bin/einhornsh CHANGED
@@ -66,7 +66,8 @@ module Einhorn
66
66
  raise EinhornSHExit
67
67
  end
68
68
  send_command({'id' => request_id, 'command' => command, 'args' => args}) do |message|
69
- puts message
69
+ $stdout.puts message
70
+ $stdout.flush
70
71
  end
71
72
  end
72
73
 
@@ -169,7 +170,7 @@ with a `-d`, provide the same argument here."
169
170
  path_to_socket = Einhorn::Command::Interface.default_socket_path(cmd_name)
170
171
  end
171
172
 
172
- sh = Einhorn::EinhornSH.new(path_to_socket)
173
+ sh = Einhorn::EinhornSH.new(path_to_socket)
173
174
 
174
175
  cmd_line_seq = options[:cmd_line_seq]
175
176
 
@@ -39,11 +39,11 @@ module Einhorn
39
39
 
40
40
  case type = spec[:type]
41
41
  when :worker
42
- Einhorn.log_info("===> Exited worker #{pid.inspect}#{extra}")
42
+ Einhorn.log_info("===> Exited worker #{pid.inspect}#{extra}", :upgrade)
43
43
  when :state_passer
44
- Einhorn.log_debug("===> Exited state passing process #{pid.inspect}")
44
+ Einhorn.log_debug("===> Exited state passing process #{pid.inspect}", :upgrade)
45
45
  else
46
- Einhorn.log_error("===> Exited process #{pid.inspect} has unrecgonized type #{type.inspect}: #{spec.inspect}")
46
+ Einhorn.log_error("===> Exited process #{pid.inspect} has unrecgonized type #{type.inspect}: #{spec.inspect}", :upgrade)
47
47
  end
48
48
  end
49
49
 
@@ -102,17 +102,17 @@ module Einhorn
102
102
  children ||= Einhorn::WorkerPool.workers
103
103
 
104
104
  signaled = []
105
- Einhorn.log_info("Sending #{signal} to #{children.inspect}")
105
+ Einhorn.log_info("Sending #{signal} to #{children.inspect}", :upgrade)
106
106
 
107
107
  children.each do |child|
108
108
  unless spec = Einhorn::State.children[child]
109
- Einhorn.log_error("Trying to send #{signal} to dead child #{child.inspect}. The fact we tried this probably indicates a bug in Einhorn.")
109
+ Einhorn.log_error("Trying to send #{signal} to dead child #{child.inspect}. The fact we tried this probably indicates a bug in Einhorn.", :upgrade)
110
110
  next
111
111
  end
112
112
 
113
113
  if record
114
114
  if spec[:signaled].include?(signal)
115
- Einhorn.log_error("Re-sending #{signal} to already-signaled child #{child.inspect}. It may be slow to spin down, or it may be swallowing #{signal}s.")
115
+ Einhorn.log_error("Re-sending #{signal} to already-signaled child #{child.inspect}. It may be slow to spin down, or it may be swallowing #{signal}s.", :upgrade)
116
116
  end
117
117
  spec[:signaled].add(signal)
118
118
  end
@@ -256,7 +256,7 @@ module Einhorn
256
256
  end
257
257
  end
258
258
 
259
- Einhorn.log_info("===> Launched #{pid}")
259
+ Einhorn.log_info("===> Launched #{pid}", :upgrade)
260
260
  Einhorn::State.children[pid] = {
261
261
  :type => :worker,
262
262
  :version => Einhorn::State.version,
@@ -400,17 +400,17 @@ module Einhorn
400
400
  old_workers = Einhorn::WorkerPool.old_workers
401
401
  Einhorn.log_debug("#{acked} acked, #{unsignaled} unsignaled, #{target} target, #{old_workers.length} old workers")
402
402
  if !Einhorn::State.upgrading && old_workers.length > 0
403
- Einhorn.log_info("Killing off #{old_workers.length} old workers.")
403
+ Einhorn.log_info("Killing off #{old_workers.length} old workers.", :upgrade)
404
404
  signal_all("USR2", old_workers)
405
405
  elsif Einhorn::State.upgrading && Einhorn::State.smooth_upgrade
406
406
  # In a smooth upgrade, kill off old workers one by one when we have
407
407
  # sufficiently many new workers.
408
408
  excess = (old_workers.length + acked) - target
409
409
  if excess > 0
410
- Einhorn.log_info("Smooth upgrade: killing off #{excess} old workers.")
410
+ Einhorn.log_info("Smooth upgrade: killing off #{excess} old workers.", :upgrade)
411
411
  signal_all("USR2", old_workers.take(excess))
412
412
  elsif excess < 0
413
- Einhorn.log_error("Smooth upgrade: somehow excess is #{excess}!")
413
+ Einhorn.log_error("Smooth upgrade: somehow excess is #{excess}!", :upgrade)
414
414
  end
415
415
  end
416
416
 
@@ -478,7 +478,7 @@ module Einhorn
478
478
  msg = "Last spinup was #{seconds_ago}s ago, and spinup_interval is #{spinup_interval}s, so spinning up a new process"
479
479
 
480
480
  if Einhorn::State.consecutive_deaths_before_ack > 0
481
- Einhorn.log_info("#{msg} (there have been #{Einhorn::State.consecutive_deaths_before_ack} consecutive unacked worker deaths)")
481
+ Einhorn.log_info("#{msg} (there have been #{Einhorn::State.consecutive_deaths_before_ack} consecutive unacked worker deaths)", :upgrade)
482
482
  else
483
483
  Einhorn.log_debug(msg)
484
484
  end
@@ -1,3 +1,3 @@
1
1
  module Einhorn
2
- VERSION = '0.5.5'
2
+ VERSION = '0.5.6'
3
3
  end
data/lib/einhorn.rb CHANGED
@@ -168,8 +168,9 @@ module Einhorn
168
168
  end
169
169
 
170
170
  # Implement these ourselves so it plays nicely with state persistence
171
- def self.log_debug(msg)
171
+ def self.log_debug(msg, tag=nil)
172
172
  $stderr.puts("#{log_tag} DEBUG: #{msg}") if Einhorn::State.verbosity <= 0
173
+ self.send_tagged_message(tag, msg) if tag
173
174
  end
174
175
  def self.log_info(msg, tag=nil)
175
176
  $stderr.puts("#{log_tag} INFO: #{msg}") if Einhorn::State.verbosity <= 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: einhorn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-25 00:00:00.000000000 Z
12
+ date: 2014-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -166,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
166
166
  version: '0'
167
167
  segments:
168
168
  - 0
169
- hash: -690549708583071819
169
+ hash: -2873954184645788574
170
170
  required_rubygems_version: !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  version: '0'
176
176
  segments:
177
177
  - 0
178
- hash: -690549708583071819
178
+ hash: -2873954184645788574
179
179
  requirements: []
180
180
  rubyforge_project:
181
181
  rubygems_version: 1.8.23