Class: JCukeForker::TaskManager
Instance Method Summary
collapse
#on_run_finished, #on_run_interrupted, #on_run_starting, #on_task_starting, #on_worker_waiting, #update
Constructor Details
#initialize(features, opts = {}) ⇒ TaskManager
Returns a new instance of TaskManager.
5
6
7
8
9
10
11
|
# File 'lib/jcukeforker/task_manager.rb', line 5
def initialize(features, opts={})
@features = features
@opts = opts
@worker_sockets = {}
@failures = false
@mutex = Mutex.new
end
|
Instance Method Details
#close ⇒ Object
28
29
30
|
# File 'lib/jcukeforker/task_manager.rb', line 28
def close
@worker_sockets.each {|k, v| v.close}
end
|
#has_failures? ⇒ Boolean
32
33
34
|
# File 'lib/jcukeforker/task_manager.rb', line 32
def has_failures?
@failures
end
|
#on_task_finished(worker_path, feature, status) ⇒ Object
18
19
20
21
|
# File 'lib/jcukeforker/task_manager.rb', line 18
def on_task_finished(worker_path, feature, status)
@failures = @failures || !status
pop_task worker_path
end
|
#on_worker_dead(worker_path) ⇒ Object
23
24
25
26
|
# File 'lib/jcukeforker/task_manager.rb', line 23
def on_worker_dead(worker_path)
socket = @worker_sockets.delete worker_path
socket.close
end
|
#on_worker_register(worker_path) ⇒ Object
13
14
15
16
|
# File 'lib/jcukeforker/task_manager.rb', line 13
def on_worker_register(worker_path)
@worker_sockets[worker_path] = UNIXSocket.open worker_path
pop_task worker_path
end
|