class Master::Process
¶ ↑
Public Instance Methods
_fork?()
click to toggle source
# File lib/spark/worker/master.rb, line 98 def _fork? return false if !::Process.respond_to?(:fork) pid = ::Process.fork exit unless pid # exit the child immediately true rescue NotImplementedError false end
create_worker()
click to toggle source
# File lib/spark/worker/master.rb, line 74 def create_worker if fork? pid = ::Process.fork do Worker::Process.new(@port).run end else pid = ::Process.spawn("ruby #{@worker_arguments} worker.rb #{@port}") end # Detach child from master to avoid zombie process ::Process.detach(pid) end
fork?()
click to toggle source
# File lib/spark/worker/master.rb, line 94 def fork? @can_fork ||= _fork? end
kill_worker()
click to toggle source
# File lib/spark/worker/master.rb, line 87 def kill_worker worker_id = @socket.read_long ::Process.kill('TERM', worker_id) rescue nil end