]>
Commit | Line | Data |
---|---|---|
d7fc9edb | 1 | require 'fileutils' |
2 | ||
3 | def run_in_background(command) | |
4 | fork { system command } | |
5 | end | |
6 | ||
7 | def with_all_segments(&block) | |
8 | 0.upto(9) do |segment_number| | |
9 | block_size = 100000 | |
10 | start_index = segment_number * block_size | |
11 | end_index = start_index + block_size - 1 | |
12 | block.call(start_index, end_index) | |
13 | end | |
14 | end | |
15 | ||
16 | #with_all_segments do |start_index, end_index| | |
17 | # puts "Initializing keys from #{start_index} to #{end_index}" | |
18 | # system "ruby worker.rb initialize #{start_index} #{end_index} 0" | |
19 | #end | |
20 | ||
21 | with_all_segments do |start_index, end_index| | |
22 | run_in_background "ruby worker.rb write #{start_index} #{end_index} 10" | |
23 | run_in_background "ruby worker.rb read #{start_index} #{end_index} 1" | |
24 | end |