bramble 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bramble/keys.rb +8 -4
- data/lib/bramble/map.rb +2 -3
- data/lib/bramble/reduce.rb +6 -3
- data/lib/bramble/result.rb +1 -1
- data/lib/bramble/state.rb +2 -1
- data/lib/bramble/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2baaf8e5894d3d7673a6888e6eab091883520c7d
|
4
|
+
data.tar.gz: 55f0b6791f770a1a6fe710d3a98972677cdfed31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e081ada613296ab5d5a410bf0759b2a425610a3618ae2d0762b762ee25689e344b10d8a2943bdf45a9b9e22534ffc78c4aac36f22fa09db9fa4d957534e78e78
|
7
|
+
data.tar.gz: 4196394526521889d7d56a4f981fad5a7152847cdf62ee1146e0d5ac4411b392fc46b6578dafac648918320ec4af0750ef50d7f4499f1fe0be38e4baf10e859d
|
data/lib/bramble/keys.rb
CHANGED
@@ -14,16 +14,20 @@ module Bramble
|
|
14
14
|
"#{namespace(handle)}:keys"
|
15
15
|
end
|
16
16
|
|
17
|
+
def map_total_count_key(handle)
|
18
|
+
"#{namespace(handle)}:map_total_count"
|
19
|
+
end
|
20
|
+
|
17
21
|
def map_finished_count_key(handle)
|
18
22
|
"#{namespace(handle)}:map_finished_count"
|
19
23
|
end
|
20
24
|
|
21
|
-
def
|
22
|
-
"#{namespace(handle)}:
|
25
|
+
def reduce_total_count_key(handle)
|
26
|
+
"#{namespace(handle)}:reduce_total_count"
|
23
27
|
end
|
24
28
|
|
25
|
-
def
|
26
|
-
"#{namespace(handle)}:
|
29
|
+
def reduce_finished_count_key(handle)
|
30
|
+
"#{namespace(handle)}:reduce_finished_count"
|
27
31
|
end
|
28
32
|
|
29
33
|
def result_key(handle)
|
data/lib/bramble/map.rb
CHANGED
@@ -6,7 +6,7 @@ module Bramble
|
|
6
6
|
|
7
7
|
def perform(handle, implementation, values)
|
8
8
|
Bramble::State.running?(handle) do
|
9
|
-
storage.set(
|
9
|
+
storage.set(map_total_count_key(handle), values.length)
|
10
10
|
values.each do |value|
|
11
11
|
Bramble::MapJob.perform_later(handle, implementation.name, Bramble::Serialize.dump(value))
|
12
12
|
end
|
@@ -25,10 +25,9 @@ module Bramble
|
|
25
25
|
end
|
26
26
|
Bramble::State.running?(handle) do
|
27
27
|
finished = storage.increment(map_finished_count_key(handle))
|
28
|
-
total = storage.get(
|
28
|
+
total = storage.get(map_total_count_key(handle)).to_i
|
29
29
|
if finished == total
|
30
30
|
Bramble::Reduce.perform(handle, implementation)
|
31
|
-
Bramble::State.clear_map(handle)
|
32
31
|
end
|
33
32
|
end
|
34
33
|
end
|
data/lib/bramble/reduce.rb
CHANGED
@@ -5,9 +5,12 @@ module Bramble
|
|
5
5
|
module_function
|
6
6
|
|
7
7
|
def perform(handle, implementation)
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
Bramble::State.running?(handle) do
|
9
|
+
all_raw_keys = storage.map_keys_get(keys_key(handle))
|
10
|
+
storage.set(reduce_total_count_key(handle), all_raw_keys.length)
|
11
|
+
all_raw_keys.each do |raw_key|
|
12
|
+
Bramble::ReduceJob.perform_later(handle, implementation.name, raw_key)
|
13
|
+
end
|
11
14
|
end
|
12
15
|
end
|
13
16
|
|
data/lib/bramble/result.rb
CHANGED
data/lib/bramble/state.rb
CHANGED
@@ -38,11 +38,12 @@ module Bramble
|
|
38
38
|
storage.delete(data_key(handle, group_key))
|
39
39
|
end
|
40
40
|
storage.delete(keys_key(handle))
|
41
|
+
storage.delete(map_total_count_key(handle))
|
41
42
|
storage.delete(map_finished_count_key(handle))
|
42
43
|
end
|
43
44
|
|
44
45
|
def clear_reduce(handle)
|
45
|
-
storage.delete(
|
46
|
+
storage.delete(reduce_total_count_key(handle))
|
46
47
|
storage.delete(reduce_finished_count_key(handle))
|
47
48
|
storage.delete(result_key(handle))
|
48
49
|
end
|
data/lib/bramble/version.rb
CHANGED