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 CHANGED
@@ -1,3 +1,5 @@
1
+ v0.3.2. Map-Reduce timing statistics available in the results.
2
+
1
3
  v0.3.1. Optimized Map-Reduce scheduler. 1.5x speed increase.
2
4
 
3
5
  v0.3. SECpack binding and migration. Now we're secure.
@@ -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
- @lock.synchronize { @tem_certs[index] = ecert }
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 }
@@ -80,7 +80,7 @@ class Server
80
80
  end
81
81
 
82
82
  # Computes the response of a single request.
83
- def process_request(request)
83
+ def process_request(request)
84
84
  case request[:type]
85
85
  when :search
86
86
  refresh_tems!
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{tem_mr_search}
5
- s.version = "0.3.1"
5
+ s.version = "0.3.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Victor Costan"]
@@ -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, :migrate].each do |task|
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]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tem_mr_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Costan