class Eye::ChildProcess

Attributes

config[R]
full_name[R]
name[R]
pid[R]
watchers[R]

Public Class Methods

new(pid, config = {}, logger_prefix = nil, parent = nil) click to toggle source
# File lib/eye/child_process.rb, line 30
def initialize(pid, config = {}, logger_prefix = nil, parent = nil)
  raise 'Empty pid' unless pid

  @pid = pid
  @config = prepare_config(config)
  @name = "child-#{pid}"
  @full_name = [logger_prefix, @name].join(':')

  @watchers = {}

  @scheduler_history = parent.scheduler_history
  @parent_pid = parent.pid

  debug { "start monitoring CHILD config: #{@config.inspect}" }

  start_checkers
end

Public Instance Methods

delete() click to toggle source
# File lib/eye/child_process.rb, line 78
def delete; end
destroy() click to toggle source
# File lib/eye/child_process.rb, line 80
def destroy
  remove_watchers
  terminate
end
logger_tag() click to toggle source
# File lib/eye/child_process.rb, line 48
def logger_tag
  full_name
end
monitor() click to toggle source
# File lib/eye/child_process.rb, line 74
def monitor; end
prepare_command(command) click to toggle source

override

Calls superclass method Eye::Process::Commands#prepare_command
# File lib/eye/child_process.rb, line 94
def prepare_command(command)
  super.gsub('{PARENT_PID}', @parent_pid.to_s)
end
restart() click to toggle source
# File lib/eye/child_process.rb, line 66
def restart
  if self[:restart_command]
    execute_restart_command
  else
    stop
  end
end
signal(sig) click to toggle source
# File lib/eye/child_process.rb, line 85
def signal(sig)
  send_signal(sig) if pid
end
start() click to toggle source
# File lib/eye/child_process.rb, line 60
def start; end
state() click to toggle source
# File lib/eye/child_process.rb, line 52
def state
  :up
end
status_data(opts = {}) click to toggle source
# File lib/eye/child_process.rb, line 89
def status_data(opts = {})
  self_status_data(opts)
end
stop() click to toggle source
# File lib/eye/child_process.rb, line 62
def stop
  kill_process
end
unmonitor() click to toggle source
# File lib/eye/child_process.rb, line 76
def unmonitor; end
up?() click to toggle source
# File lib/eye/child_process.rb, line 56
def up?
  state == :up
end