tem_mr_search 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/bin/tem_mr_search_server +2 -0
- data/lib/tem_mr_search/map_reduce_executor.rb +10 -2
- data/lib/tem_mr_search/server.rb +1 -1
- data/tem_mr_search.gemspec +1 -1
- data/test/test_map_reduce_executor.rb +2 -1
- metadata +1 -1
data/CHANGELOG
CHANGED
data/bin/tem_mr_search_server
CHANGED
@@ -11,4 +11,6 @@ end
|
|
11
11
|
Thread.abort_on_exception = true
|
12
12
|
db_file, cluster_file, server_port = ARGV[0], ARGV[1], ARGV[2]
|
13
13
|
server = Tem::Mr::Search::Server.new db_file, cluster_file, server_port
|
14
|
+
default_port = Tem::Mr::Search::Server::DEFAULT_PORT
|
15
|
+
print "Serving on port #{server_port || default_port}\n"
|
14
16
|
server.serve_loop
|
@@ -49,7 +49,7 @@ class MapReduceExecutor
|
|
49
49
|
# Protected by @lock
|
50
50
|
@timings = { :tems => Array.new(@tems.length, 0.0),
|
51
51
|
:tasks => { :map => 0.0, :reduce => 0.0, :finalize => 0.0,
|
52
|
-
:migrate => 0.0 } }
|
52
|
+
:migrate => 0.0, :tem_ids => 0.0 } }
|
53
53
|
|
54
54
|
# Thread-safe.
|
55
55
|
@thread_queues = tems.map { |tem| Queue.new }
|
@@ -63,6 +63,7 @@ class MapReduceExecutor
|
|
63
63
|
# :result:: the job's result
|
64
64
|
# :timings:: timing statistics on the job's execution
|
65
65
|
def execute
|
66
|
+
t0 = Time.now
|
66
67
|
collect_tem_ids
|
67
68
|
|
68
69
|
# Spawn TEM threads.
|
@@ -77,6 +78,7 @@ class MapReduceExecutor
|
|
77
78
|
action = @main_queue.pop
|
78
79
|
@planner.action_done action
|
79
80
|
end
|
81
|
+
@timings[:total] = Time.now - t0
|
80
82
|
|
81
83
|
return { :result => @outputs[@planner.output_id], :timings => @timings }
|
82
84
|
end
|
@@ -85,8 +87,14 @@ class MapReduceExecutor
|
|
85
87
|
def collect_tem_ids
|
86
88
|
threads = (0...@tems.length).map do |tem_index|
|
87
89
|
Thread.new(tem_index, @tems[tem_index]) do |index, tem|
|
90
|
+
t0 = Time.now
|
88
91
|
ecert = tem.endorsement_cert
|
89
|
-
|
92
|
+
time_delta = Time.now - t0
|
93
|
+
@lock.synchronize do
|
94
|
+
@tem_certs[index] = ecert
|
95
|
+
@timings[:tasks][:tem_ids] += time_delta
|
96
|
+
@timings[:tems][index] += time_delta
|
97
|
+
end
|
90
98
|
end
|
91
99
|
end
|
92
100
|
threads.each { |thread| thread.join }
|
data/lib/tem_mr_search/server.rb
CHANGED
data/tem_mr_search.gemspec
CHANGED
@@ -35,11 +35,12 @@ class MapReduceExecutorTest < MrTestCase
|
|
35
35
|
|
36
36
|
assert data[:timings], 'No timings returned'
|
37
37
|
assert data[:timings][:tasks], 'No tasks data in the timings'
|
38
|
-
[:map, :reduce, :finalize
|
38
|
+
[:tem_ids, :migrate, :map, :reduce, :finalize].each do |task|
|
39
39
|
assert data[:timings][:tasks][task], "No data on #{task} in the timings"
|
40
40
|
end
|
41
41
|
assert_operator data[:timings][:tems], :kind_of?, Array,
|
42
42
|
'No per-TEM data in the timings'
|
43
|
+
assert data[:timings][:total], 'No total time in the timings'
|
43
44
|
|
44
45
|
# Dump timing stats to show scheduler performance.
|
45
46
|
p data[:timings]
|