Class: Master::Thread
Overview
Worker::Thread
Constant Summary
Constants included from Spark::Constant
Spark::Constant::ACCUMULATOR_ACK, Spark::Constant::CREATE_WORKER, Spark::Constant::DATA_EOF, Spark::Constant::KILL_WORKER, Spark::Constant::KILL_WORKER_AND_WAIT, Spark::Constant::SUCCESSFULLY_KILLED, Spark::Constant::UNSUCCESSFUL_KILLING, Spark::Constant::WORKER_DONE, Spark::Constant::WORKER_ERROR
Instance Method Summary collapse
- #create_worker ⇒ Object
-
#initialize ⇒ Thread
constructor
A new instance of Thread.
- #kill_worker ⇒ Object
Methods inherited from Base
#kill_worker_and_wait, #receive_message, #run
Constructor Details
#initialize ⇒ Thread
Returns a new instance of Thread.
115 116 117 118 119 120 121 122 123 |
# File 'lib/spark/worker/master.rb', line 115 def initialize ::Thread.abort_on_exception = true # For synchronous access to socket IO $mutex_for_command = Mutex.new $mutex_for_iterator = Mutex.new super end |
Instance Method Details
#create_worker ⇒ Object
125 126 127 128 129 |
# File 'lib/spark/worker/master.rb', line 125 def create_worker ::Thread.new do Worker::Thread.new(@port).run end end |
#kill_worker ⇒ Object
131 132 133 134 135 136 137 138 |
# File 'lib/spark/worker/master.rb', line 131 def kill_worker worker_id = @socket.read_long thread = ObjectSpace._id2ref(worker_id) thread.kill rescue nil end |