elasticity 2.6 → 2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/.ruby-version +1 -1
- data/.travis.yml +0 -1
- data/HISTORY.md +9 -3
- data/README.md +25 -5
- data/elasticity.gemspec +1 -1
- data/lib/elasticity.rb +2 -0
- data/lib/elasticity/emr.rb +1 -1
- data/lib/elasticity/s3distcp_step.rb +16 -0
- data/lib/elasticity/script_step.rb +13 -0
- data/lib/elasticity/version.rb +1 -1
- data/spec/lib/elasticity/emr_spec.rb +18 -1
- data/spec/lib/elasticity/s3distcp_step_spec.rb +11 -0
- data/spec/lib/elasticity/script_step_spec.rb +11 -0
- metadata +16 -10
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NWE3MTZjMzY1Mjc1NGM2MTBkMDgzNzlkZmRjZTllNWYxMzQ1MWE5Mg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MzljODgxYWQ1YjhkOWZlZGVhZWViNzhhMzFlYjlhYTdjZmZiNjUyNg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OTU3OTk2ZjUxZTU1NTE2NGM0MTBhNjMzYTAxNjY3MzdhNTJiN2FlZmQzZDg3
|
10
|
+
NTI1Y2I2MDkzZmIwZDVmYzUzOTY1Y2U4YzY3MzkzNWJjOWI5YTVhNWRiNzQw
|
11
|
+
OWJmM2E1NjFkYTQ3ZDljNjZlZmExOWQ5Y2FmYTI3YTg4MThkMDM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MTJmNWIxZWNiOGUxODI0N2MwYjE1OGVlNmZjYThmYjlkMDM0Yzg0MDQyZmNj
|
14
|
+
NTRiNGMxNmM0M2Y1ZDVhZGFjYTMxZGZkMzI2NjFlMTc0ZTk0ODdlYmFmNzU2
|
15
|
+
YjU4OWJmZDM3NDI5MWUwODFmYjBjN2M5NzNjODFlMzZkYjNmMDQ=
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.3-p484
|
data/.travis.yml
CHANGED
data/HISTORY.md
CHANGED
@@ -1,12 +1,18 @@
|
|
1
|
+
## 2.7 - December 4, 2013
|
2
|
+
|
3
|
+
- `Elasticity::S3DistCp` and `Elasticity::ScriptStep` added to provide easy access to remote copying and arbitrary script execution.
|
4
|
+
- `Elasticity::EMR` can now autodetect AWS credentials.
|
5
|
+
- Baseline support now is now 1.9.3-p484. Dropped support for Ruby 1.9.2 as it was [EOL on 2013/06/01](http://bugs.ruby-lang.org/projects/ruby/wiki/ReleaseEngineering).
|
6
|
+
- Dev update: No longer using `guard-rspec`.
|
7
|
+
- Dev update: Added `unf` as an explicit dependency as `fog` no longer includes it since it's AWS-only.
|
8
|
+
|
1
9
|
## 2.6 - August 17, 2013
|
2
10
|
|
3
11
|
+ Added debugging support via `JobFlow#enable_debugging`. Note that this requires `JobFlow#log_uri` to be set.
|
4
12
|
+ Added job flow completion polling via `JobFlow#wait_for_completion`.
|
5
13
|
+ Added testing to support Ruby 2.0.
|
6
14
|
+ Removed support for REE and 1.8.7 as these are now unsupported versions of Ruby. Common strategy in the Ruby community has been to only perform a minor version bump in this case; Elasticity is following suit.
|
7
|
-
+ Now
|
8
|
-
|
9
|
-
### Development
|
15
|
+
+ Now specifying minor versions in the gemspec. With the release of Ruby 2.0, I'm anticipating breaking changes coming to many gems, and hoping that this mitigates those effects.
|
10
16
|
+ Dev update: guard-rspec added.
|
11
17
|
+ Dev update: All development dependencies now require Ruby >= 1.9.2.
|
12
18
|
+ Dev update: Latest version of Ruby 1.9.2 (p320).
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/elasticity.png)](http://badge.fury.io/rb/elasticity)
|
2
2
|
|
3
|
-
**(
|
3
|
+
**(December 4, 2013)** Taking requests! I have a few ideas for what might be cool features though I'd rather work on what the community wants. Go ahead and file an issue!
|
4
4
|
|
5
5
|
Elasticity provides programmatic access to Amazon's Elastic Map Reduce service. The aim is to conveniently abstract away the complex EMR REST API and make working with job flows more productive and more enjoyable.
|
6
6
|
|
7
|
-
[![Build Status](https://secure.travis-ci.org/rslifka/elasticity.png)](http://travis-ci.org/rslifka/elasticity) 1.9.
|
7
|
+
[![Build Status](https://secure.travis-ci.org/rslifka/elasticity.png)](http://travis-ci.org/rslifka/elasticity) 1.9.3, 2.0.0
|
8
8
|
|
9
9
|
Elasticity provides two ways to access EMR:
|
10
10
|
|
@@ -20,7 +20,7 @@ gem install elasticity
|
|
20
20
|
or in your Gemfile
|
21
21
|
|
22
22
|
```
|
23
|
-
gem 'elasticity', '~> 2.
|
23
|
+
gem 'elasticity', '~> 2.7'
|
24
24
|
```
|
25
25
|
|
26
26
|
This will ensure that you protect yourself from API changes, which will only be made in major revisions.
|
@@ -281,13 +281,33 @@ jar_step.arguments = ['arg1', 'arg2']
|
|
281
281
|
jobflow.add_step(jar_step)
|
282
282
|
```
|
283
283
|
|
284
|
+
### Adding a Script Step
|
285
|
+
|
286
|
+
```ruby
|
287
|
+
# Path to your script, plus arguments
|
288
|
+
script_step = Elasticity::ScriptStep.new('script_location', 'arg1', 'arg2')
|
289
|
+
|
290
|
+
jobflow.add_step(script_step)
|
291
|
+
```
|
292
|
+
|
293
|
+
### Adding an S3DistCp Step
|
294
|
+
|
295
|
+
For a complete list of supported arguments, please see the [Amazon EMR guide](http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_s3distcp.html).
|
296
|
+
|
297
|
+
```ruby
|
298
|
+
# Path to your script, plus arguments (both symbols and strings are supported)
|
299
|
+
copy_step = Elasticity::S3DistCpStep.new(:arg1 => 'value1', 'arg2' => 'value2')
|
300
|
+
|
301
|
+
jobflow.add_step(copy_step)
|
302
|
+
```
|
303
|
+
|
284
304
|
## 6 - Upload Assets (optional)
|
285
305
|
|
286
306
|
This isn't part of ```JobFlow```; more of an aside. Elasticity provides a very basic means of uploading assets to S3 so that your EMR job has access to them. Most commonly this will be a set of resources to run the job (e.g. JAR files, streaming scripts, etc.) and a set of resources used by the job itself (e.g. a TSV file with a range of valid values, join tables, etc.).
|
287
307
|
|
288
308
|
```ruby
|
289
309
|
# Specify the bucket name, AWS credentials and region
|
290
|
-
s3 = Elasticity::SyncToS3('my-bucket', 'access', 'secret', 'region')
|
310
|
+
s3 = Elasticity::SyncToS3.new('my-bucket', 'access', 'secret', 'region')
|
291
311
|
|
292
312
|
# Alternatively, specify nothing :)
|
293
313
|
# - Use the standard environment variables (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY)
|
@@ -331,7 +351,7 @@ And with a status callback, providing the elapsed time and an instance of ```Ela
|
|
331
351
|
```ruby
|
332
352
|
# Blocks until status changes, calling back every 60 seconds
|
333
353
|
jobflow.wait_for_completion do |elapsed_time, job_flow_status|
|
334
|
-
puts "Waiting for #{
|
354
|
+
puts "Waiting for #{elapsed_time}, jobflow status: #{job_flow_status.state}"
|
335
355
|
end
|
336
356
|
```
|
337
357
|
|
data/elasticity.gemspec
CHANGED
@@ -14,9 +14,9 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.add_dependency('rest-client', '~> 1.0')
|
15
15
|
s.add_dependency('nokogiri', '~> 1.0')
|
16
16
|
s.add_dependency('fog', '~> 1.0')
|
17
|
+
s.add_dependency('unf', '~> 0.1')
|
17
18
|
|
18
19
|
s.add_development_dependency('fakefs', '~> 0.4.0')
|
19
|
-
s.add_development_dependency('guard-rspec', '~> 3.0')
|
20
20
|
s.add_development_dependency('rake', '~> 0.9')
|
21
21
|
s.add_development_dependency('rspec', '~> 2.14.0')
|
22
22
|
s.add_development_dependency('timecop', '~> 0.6')
|
data/lib/elasticity.rb
CHANGED
data/lib/elasticity/emr.rb
CHANGED
@@ -4,7 +4,7 @@ module Elasticity
|
|
4
4
|
|
5
5
|
attr_reader :aws_request
|
6
6
|
|
7
|
-
def initialize(aws_access_key_id, aws_secret_access_key, options = {})
|
7
|
+
def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, options = {})
|
8
8
|
@aws_request = Elasticity::AwsRequest.new(aws_access_key_id, aws_secret_access_key, options)
|
9
9
|
end
|
10
10
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Elasticity
|
2
|
+
|
3
|
+
class S3DistCpStep < CustomJarStep
|
4
|
+
|
5
|
+
def initialize(options)
|
6
|
+
@name = 'Elasticity S3DistCp Step'
|
7
|
+
@jar = '/home/hadoop/lib/emr-s3distcp-1.0.jar'
|
8
|
+
@arguments = []
|
9
|
+
options.each do |argument, value|
|
10
|
+
@arguments << '--arg' << argument.to_s << '--arg' << value
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Elasticity
|
2
|
+
|
3
|
+
class ScriptStep < CustomJarStep
|
4
|
+
|
5
|
+
def initialize(script_name, *script_args)
|
6
|
+
@name = 'Elasticity Script Step'
|
7
|
+
@jar = 's3://elasticmapreduce/libs/script-runner/script-runner.jar'
|
8
|
+
@arguments = ["#{script_name} #{script_args.join(' ')}"]
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
data/lib/elasticity/version.rb
CHANGED
@@ -4,7 +4,24 @@ describe Elasticity::EMR do
|
|
4
4
|
Elasticity::EMR.new('ACCESS', 'SECRET')
|
5
5
|
end
|
6
6
|
|
7
|
-
|
7
|
+
describe '.new' do
|
8
|
+
|
9
|
+
context 'when arguments are provided' do
|
10
|
+
its(:aws_request) { should == Elasticity::AwsRequest.new('ACCESS', 'SECRET', {}) }
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'when arguments are not provided' do
|
14
|
+
before do
|
15
|
+
ENV.stub(:[]).with('AWS_ACCESS_KEY_ID').and_return('ENV_ACCESS')
|
16
|
+
ENV.stub(:[]).with('AWS_SECRET_ACCESS_KEY').and_return('ENV_SECRET')
|
17
|
+
end
|
18
|
+
it 'should use environment variables' do
|
19
|
+
emr = Elasticity::EMR.new
|
20
|
+
emr.aws_request.should == Elasticity::AwsRequest.new('ENV_ACCESS', 'ENV_SECRET', {})
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
8
25
|
|
9
26
|
describe '#add_instance_groups' do
|
10
27
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
describe Elasticity::S3DistCpStep do
|
2
|
+
|
3
|
+
it { should be_a Elasticity::CustomJarStep }
|
4
|
+
|
5
|
+
subject { Elasticity::S3DistCpStep.new({'arg1' => 'value1', :arg2 => 'value2'}) }
|
6
|
+
|
7
|
+
its(:name) { should == 'Elasticity S3DistCp Step' }
|
8
|
+
its(:jar) { should == '/home/hadoop/lib/emr-s3distcp-1.0.jar' }
|
9
|
+
its(:arguments) { should == %w(--arg arg1 --arg value1 --arg arg2 --arg value2) }
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
describe Elasticity::ScriptStep do
|
2
|
+
|
3
|
+
it { should be_a Elasticity::CustomJarStep }
|
4
|
+
|
5
|
+
subject { Elasticity::ScriptStep.new('script_location', 'arg1', 'arg2') }
|
6
|
+
|
7
|
+
its(:name) { should == 'Elasticity Script Step' }
|
8
|
+
its(:jar) { should == 's3://elasticmapreduce/libs/script-runner/script-runner.jar' }
|
9
|
+
its(:arguments) { should == ['script_location arg1 arg2'] }
|
10
|
+
|
11
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.
|
4
|
+
version: '2.7'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Slifka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -53,33 +53,33 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: unf
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
62
|
-
type: :
|
61
|
+
version: '0.1'
|
62
|
+
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: '0.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: fakefs
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 0.4.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 0.4.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,6 +156,8 @@ files:
|
|
156
156
|
- lib/elasticity/job_flow_step.rb
|
157
157
|
- lib/elasticity/looper.rb
|
158
158
|
- lib/elasticity/pig_step.rb
|
159
|
+
- lib/elasticity/s3distcp_step.rb
|
160
|
+
- lib/elasticity/script_step.rb
|
159
161
|
- lib/elasticity/setup_hadoop_debugging_step.rb
|
160
162
|
- lib/elasticity/streaming_step.rb
|
161
163
|
- lib/elasticity/sync_to_s3.rb
|
@@ -175,6 +177,8 @@ files:
|
|
175
177
|
- spec/lib/elasticity/job_flow_step_spec.rb
|
176
178
|
- spec/lib/elasticity/looper_spec.rb
|
177
179
|
- spec/lib/elasticity/pig_step_spec.rb
|
180
|
+
- spec/lib/elasticity/s3distcp_step_spec.rb
|
181
|
+
- spec/lib/elasticity/script_step_spec.rb
|
178
182
|
- spec/lib/elasticity/setup_hadoop_debugging_step_spec.rb
|
179
183
|
- spec/lib/elasticity/streaming_step_spec.rb
|
180
184
|
- spec/lib/elasticity/sync_to_s3_spec.rb
|
@@ -199,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
203
|
version: '0'
|
200
204
|
requirements: []
|
201
205
|
rubyforge_project:
|
202
|
-
rubygems_version: 2.
|
206
|
+
rubygems_version: 2.1.11
|
203
207
|
signing_key:
|
204
208
|
specification_version: 4
|
205
209
|
summary: Streamlined, programmatic access to Amazon's Elastic Map Reduce service.
|
@@ -219,6 +223,8 @@ test_files:
|
|
219
223
|
- spec/lib/elasticity/job_flow_step_spec.rb
|
220
224
|
- spec/lib/elasticity/looper_spec.rb
|
221
225
|
- spec/lib/elasticity/pig_step_spec.rb
|
226
|
+
- spec/lib/elasticity/s3distcp_step_spec.rb
|
227
|
+
- spec/lib/elasticity/script_step_spec.rb
|
222
228
|
- spec/lib/elasticity/setup_hadoop_debugging_step_spec.rb
|
223
229
|
- spec/lib/elasticity/streaming_step_spec.rb
|
224
230
|
- spec/lib/elasticity/sync_to_s3_spec.rb
|