simple_map_reduce 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +141 -0
- data/.rspec +2 -0
- data/.rubocop.yml +69 -0
- data/.ruby-version +1 -0
- data/.travis.yml +8 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Dockerfile +9 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +107 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/job_tracker +18 -0
- data/bin/job_worker1 +22 -0
- data/bin/job_worker2 +22 -0
- data/bin/job_worker3 +22 -0
- data/bin/register_word_count_job +80 -0
- data/bin/setup +8 -0
- data/docker-compose.yml +98 -0
- data/exe/simple_map_reduce +183 -0
- data/lib/simple_map_reduce/driver/config.rb +8 -0
- data/lib/simple_map_reduce/driver/job.rb +8 -0
- data/lib/simple_map_reduce/s3_client.rb +15 -0
- data/lib/simple_map_reduce/server/confg.rb +42 -0
- data/lib/simple_map_reduce/server/job.rb +129 -0
- data/lib/simple_map_reduce/server/job_tracker.rb +304 -0
- data/lib/simple_map_reduce/server/job_worker.rb +96 -0
- data/lib/simple_map_reduce/server/task.rb +92 -0
- data/lib/simple_map_reduce/server/worker.rb +76 -0
- data/lib/simple_map_reduce/version.rb +5 -0
- data/lib/simple_map_reduce/worker/register_map_task_worker.rb +51 -0
- data/lib/simple_map_reduce/worker/run_map_task_worker.rb +161 -0
- data/lib/simple_map_reduce/worker/run_reduce_task_worker.rb +97 -0
- data/lib/simple_map_reduce.rb +32 -0
- data/simple_map_reduce.gemspec +41 -0
- metadata +290 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d3935042506d22ac79df4b198afd843a43e390da4271c9759aac3085d4089cb7
|
4
|
+
data.tar.gz: 63e0b638ccf73c436b06503b581d0d36e42b84ffb98fa00b39db5386a37fb0b3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4553f2db3b813c84ae47b38e1e101af879c85c34c58198a36ffc5c5b5ad44d359e3dd6b509a539f3f673cbb108c17ea5f3b846aa8e2e90a93b5c2f62635c6e53
|
7
|
+
data.tar.gz: 2bc3bde335613c60d77b90ca69052391c6842478cd317b60658c6e7aaf54f40637d7537cece15dc307a7407d49ee670b2c175cf0fd925bb1b99d91a586327515
|
data/.gitignore
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
### https://raw.github.com/github/gitignore/44cbb3686c18f634a488ea123d1148ca9a64fa22/Ruby.gitignore
|
2
|
+
|
3
|
+
*.gem
|
4
|
+
*.rbc
|
5
|
+
/.config
|
6
|
+
/coverage/
|
7
|
+
/InstalledFiles
|
8
|
+
/pkg/
|
9
|
+
/spec/reports/
|
10
|
+
/spec/examples.txt
|
11
|
+
/test/tmp/
|
12
|
+
/test/version_tmp/
|
13
|
+
/tmp/
|
14
|
+
/Gemfile.lock
|
15
|
+
|
16
|
+
# Used by dotenv library to load environment variables.
|
17
|
+
# .env
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/vendor/ruby
|
45
|
+
/lib/bundler/man/
|
46
|
+
|
47
|
+
# for a library or gem, you might want to ignore these files since the code is
|
48
|
+
# intended to run in multiple environments; otherwise, check them in:
|
49
|
+
# Gemfile.lock
|
50
|
+
# .ruby-version
|
51
|
+
# .ruby-gemset
|
52
|
+
|
53
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
54
|
+
.rvmrc
|
55
|
+
|
56
|
+
|
57
|
+
### https://raw.github.com/github/gitignore/44cbb3686c18f634a488ea123d1148ca9a64fa22/Global/JetBrains.gitignore
|
58
|
+
|
59
|
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
60
|
+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
61
|
+
|
62
|
+
# User-specific stuff:
|
63
|
+
.idea/**/workspace.xml
|
64
|
+
.idea/**/tasks.xml
|
65
|
+
.idea/dictionaries
|
66
|
+
|
67
|
+
# Sensitive or high-churn files:
|
68
|
+
.idea/**/dataSources/
|
69
|
+
.idea/**/dataSources.ids
|
70
|
+
.idea/**/dataSources.xml
|
71
|
+
.idea/**/dataSources.local.xml
|
72
|
+
.idea/**/sqlDataSources.xml
|
73
|
+
.idea/**/dynamic.xml
|
74
|
+
.idea/**/uiDesigner.xml
|
75
|
+
|
76
|
+
# Gradle:
|
77
|
+
.idea/**/gradle.xml
|
78
|
+
.idea/**/libraries
|
79
|
+
|
80
|
+
# CMake
|
81
|
+
cmake-build-debug/
|
82
|
+
|
83
|
+
# Mongo Explorer plugin:
|
84
|
+
.idea/**/mongoSettings.xml
|
85
|
+
|
86
|
+
## File-based project format:
|
87
|
+
*.iws
|
88
|
+
|
89
|
+
## Plugin-specific files:
|
90
|
+
|
91
|
+
# IntelliJ
|
92
|
+
/out/
|
93
|
+
|
94
|
+
# mpeltonen/sbt-idea plugin
|
95
|
+
.idea_modules/
|
96
|
+
|
97
|
+
# JIRA plugin
|
98
|
+
atlassian-ide-plugin.xml
|
99
|
+
|
100
|
+
# Cursive Clojure plugin
|
101
|
+
.idea/replstate.xml
|
102
|
+
|
103
|
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
104
|
+
com_crashlytics_export_strings.xml
|
105
|
+
crashlytics.properties
|
106
|
+
crashlytics-build.properties
|
107
|
+
fabric.properties
|
108
|
+
|
109
|
+
|
110
|
+
### https://raw.github.com/github/gitignore/44cbb3686c18f634a488ea123d1148ca9a64fa22/Global/MacOS.gitignore
|
111
|
+
|
112
|
+
*.DS_Store
|
113
|
+
.AppleDouble
|
114
|
+
.LSOverride
|
115
|
+
|
116
|
+
# Icon must end with two \r
|
117
|
+
Icon
|
118
|
+
|
119
|
+
|
120
|
+
# Thumbnails
|
121
|
+
._*
|
122
|
+
|
123
|
+
# Files that might appear in the root of a volume
|
124
|
+
.DocumentRevisions-V100
|
125
|
+
.fseventsd
|
126
|
+
.Spotlight-V100
|
127
|
+
.TemporaryItems
|
128
|
+
.Trashes
|
129
|
+
.VolumeIcon.icns
|
130
|
+
.com.apple.timemachine.donotpresent
|
131
|
+
|
132
|
+
# Directories potentially created on remote AFP share
|
133
|
+
.AppleDB
|
134
|
+
.AppleDesktop
|
135
|
+
Network Trash Folder
|
136
|
+
Temporary Items
|
137
|
+
.apdisk
|
138
|
+
.rspec_status
|
139
|
+
/input.txt
|
140
|
+
|
141
|
+
!.gitkeep
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.3
|
3
|
+
DisplayCopNames: true
|
4
|
+
|
5
|
+
PercentLiteralDelimiters:
|
6
|
+
PreferredDelimiters:
|
7
|
+
'%': ()
|
8
|
+
'%i': ()
|
9
|
+
'%q': ()
|
10
|
+
'%Q': ()
|
11
|
+
'%r': ()
|
12
|
+
'%s': ()
|
13
|
+
'%w': ()
|
14
|
+
'%W': ()
|
15
|
+
'%x': ()
|
16
|
+
|
17
|
+
Metrics/BlockLength:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Metrics/LineLength:
|
21
|
+
Max: 128
|
22
|
+
|
23
|
+
Metrics/ClassLength:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Metrics/MethodLength:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Style/IfUnlessModifier:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Style/GuardClause:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Layout/AlignArray:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Layout/AlignHash:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Layout/AlignParameters:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Style/RescueStandardError:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
Naming/HeredocDelimiterNaming:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Style/Documentation:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
Style/NumericPredicate:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
Metrics/AbcSize:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
Metrics/ParameterLists:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
Lint/AmbiguousBlockAssociation:
|
63
|
+
Enabled: false
|
64
|
+
|
65
|
+
Metrics/CyclomaticComplexity:
|
66
|
+
Max: 10
|
67
|
+
|
68
|
+
Metrics/PerceivedComplexity:
|
69
|
+
Max: 10
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.0
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at nserihiro@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Dockerfile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
FROM ruby:2.5.0
|
2
|
+
|
3
|
+
WORKDIR /app
|
4
|
+
|
5
|
+
ADD simple_map_reduce.gemspec /app/simple_map_reduce.gemspec
|
6
|
+
ADD Gemfile /app/Gemfile
|
7
|
+
ADD lib/simple_map_reduce/version.rb /app/lib/simple_map_reduce/version.rb
|
8
|
+
RUN gem install bundler
|
9
|
+
RUN bundle install -j 4 --path=vendor/bundle
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Kazuhiro Serizawa
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
# SimpleMapReduce
|
2
|
+
|
3
|
+
- This is a [MapReduce](https://research.google.com/archive/mapreduce.html) implementation distributed framework written in ruby.
|
4
|
+
- This project is a experience project. So, the specifications will be changed suddenly.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'simple_map_reduce'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install simple_map_reduce
|
21
|
+
|
22
|
+
## Quick start in local environment with minio
|
23
|
+
|
24
|
+
### 1. Start minio server
|
25
|
+
|
26
|
+
```sh
|
27
|
+
$ docker run -p 9000:9000 -e "MINIO_ACCESS_KEY=MINIO_ACCESS_KEY" -e "MINIO_SECRET_KEY=MINIO_SECRET_KEY" minio/minio server /data
|
28
|
+
```
|
29
|
+
|
30
|
+
### 2. Start job tracker
|
31
|
+
|
32
|
+
```sh
|
33
|
+
$ bundle exec simple_map_reduce run_job_tracker! \
|
34
|
+
--job-tracker-url=http://job_tracker:4567 \
|
35
|
+
--server-port=4567 \
|
36
|
+
--s3_config=access_key_id:'MINIO_ACCESS_KEY' \
|
37
|
+
secret_access_key:'MINIO_SECRET_KEY' \
|
38
|
+
endpoint:'http://127.0.0.1:9000' \
|
39
|
+
region:'us-east-1' \
|
40
|
+
force_path_style:true
|
41
|
+
```
|
42
|
+
|
43
|
+
### 3. Start job worker(s)
|
44
|
+
|
45
|
+
```sh
|
46
|
+
$ bundle exec simple_map_reduce run_job_worker! \
|
47
|
+
--job-tracker-url=http://localhost:4567 \
|
48
|
+
--job-worker-url=http://localhost:4568 \
|
49
|
+
--server-port=4568 \
|
50
|
+
--s3_config=access_key_id:'MINIO_ACCESS_KEY' \
|
51
|
+
secret_access_key:'MINIO_SECRET_KEY' \
|
52
|
+
endpoint:'http://127.0.0.1:9000' \
|
53
|
+
region:'us-east-1' \
|
54
|
+
force_path_style:true
|
55
|
+
```
|
56
|
+
|
57
|
+
### 4. Generate and upload test data
|
58
|
+
|
59
|
+
```sh
|
60
|
+
$ bundle exec simple_map_reduce generate_lorem_text_data --upload=true
|
61
|
+
```
|
62
|
+
|
63
|
+
### 5. Execute word count job
|
64
|
+
|
65
|
+
```sh
|
66
|
+
$ bundle exec simple_map_reduce execute_word_count
|
67
|
+
```
|
68
|
+
|
69
|
+
## Quick start in Docker Compose
|
70
|
+
|
71
|
+
- You can setup a simple_map_reduce cluster by docker-compose.
|
72
|
+
|
73
|
+
```sh
|
74
|
+
$ clone git@github.com:serihiro/simple_map_reduce.git
|
75
|
+
$ cd simple_map_reduce
|
76
|
+
$ docker-compose up
|
77
|
+
```
|
78
|
+
|
79
|
+
- You can execute word count sample by executing following commands
|
80
|
+
|
81
|
+
```sh
|
82
|
+
$ docker-compose exec job_tracker bundle exec simple_map_reduce generate_lorem_text_data --upload=true
|
83
|
+
$ docker-compose exec job_tracker bundle exec simple_map_reduce execute_word_count
|
84
|
+
```
|
85
|
+
|
86
|
+
## Motivation of this project
|
87
|
+
- I would like to lean the theory of distributed systems, big data processing, and MapReduce.
|
88
|
+
- From my experiences, I believe that an implementation of them is best way to learn them.
|
89
|
+
- So I decide to create an experimental implementation, and keep adding new features in order to get an practical experiences of theories which I would learn.
|
90
|
+
|
91
|
+
## Development
|
92
|
+
|
93
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
94
|
+
|
95
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
96
|
+
|
97
|
+
## Contributing
|
98
|
+
|
99
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/simple_map_reduce. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
100
|
+
|
101
|
+
## License
|
102
|
+
|
103
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
104
|
+
|
105
|
+
## Code of Conduct
|
106
|
+
|
107
|
+
Everyone interacting in the SimpleMapReduce project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/simple_map_reduce/blob/master/CODE_OF_CONDUCT.md).
|