mongo_mapper_parallel 1.0.9.1 → 1.0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/mongo_mapper_parallel.rb +10 -3
- metadata +1 -16
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzY4OGRmMTBjMGEwMGEzZTQzZjVlYTM5NTk1MWRmOTRmYzlkODVlOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTdjMWQ3Nzc1NjhmNGFiYmY4MDk5NGYxNjc5OGMzZTEyNGE2MTlmYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjU5YTM1OTIwMGYzMzAxM2Y2ZGFjYWQ2MmY1NjM0Y2I0MWNkM2VkZGRhZmVi
|
10
|
+
YjdkZWYwNDk2OTliNzM5ZWY1MjFmZWJhMzA4ODY5NWE5NzFkMTc1MzczODBj
|
11
|
+
YjcyZWU3NTY3YWZkOTZhNTEyZTE1NjZkZmMyYTgzZTM4OWE3OTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGQyOTcxZTBhZGM4M2JjZTNjMDQwMzZlZWExNmE1MDMzMmQ3NzhlYTBlYTBl
|
14
|
+
ZDI5MDQ4MTY1MTliY2ViMGQ5NTRlNjdlOTczMjcyMTEyYTE5NjVlOTdmOWU4
|
15
|
+
NjlhYjU1YmFhYjc5MmE3NzUxOWIzOTRiYTY5MDYzOWIzODhmMDY=
|
@@ -1,9 +1,14 @@
|
|
1
1
|
# @author Jonathan Raiman
|
2
2
|
require 'parallel' # for parallel processing
|
3
|
-
require 'colorize' # for colored output
|
4
3
|
require 'mongo_mapper' # for access to collections.
|
5
4
|
require 'jraiman_progressbar' # to display progress
|
6
5
|
|
6
|
+
class String
|
7
|
+
def green
|
8
|
+
"\e[0;32;49m" + self + "\e[0m"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
7
12
|
class MongoMapperParallel
|
8
13
|
# runs distributed computation over a Mongo collection
|
9
14
|
|
@@ -13,6 +18,8 @@ class MongoMapperParallel
|
|
13
18
|
attr_accessor :args
|
14
19
|
attr_accessor :debug
|
15
20
|
|
21
|
+
|
22
|
+
|
16
23
|
class Key
|
17
24
|
# A chunk that will be parallelized
|
18
25
|
attr_accessor :future_key
|
@@ -68,14 +75,14 @@ class MongoMapperParallel
|
|
68
75
|
raise Mongo::ConnectionFailure.new "Connection disconnected at position #{@position}"
|
69
76
|
end
|
70
77
|
@completed = true
|
71
|
-
puts "Completed chunk (#{@position})".green if @debug
|
78
|
+
puts "Completed chunk (#{@position})".green if @debug and
|
72
79
|
end
|
73
80
|
end
|
74
81
|
|
75
82
|
# Obtains the first key
|
76
83
|
# @return [Object] the first split key.
|
77
84
|
def get_first_split_key
|
78
|
-
@command_class.where().order(@split.to_sym).fields(@split.to_sym).first.send(@split.to_sym)
|
85
|
+
@command_class.count > 0 ? @command_class.where().order(@split.to_sym).fields(@split.to_sym).first.send(@split.to_sym) : nil
|
79
86
|
end
|
80
87
|
|
81
88
|
# Obtains the splitVectors keys to find chunks to parallelize via the MongoDB `splitVector` command.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo_mapper_parallel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.9.
|
4
|
+
version: 1.0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Raiman
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: colorize
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ! '>='
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ! '>='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: parallel
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,7 +83,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
83
|
requirements:
|
98
84
|
- MongoDB, 2.4+
|
99
85
|
- mongo_mapper
|
100
|
-
- colorize
|
101
86
|
- parallel
|
102
87
|
- jraiman_progressbar
|
103
88
|
rubyforge_project:
|