elasticity 2.7 → 3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWE3MTZjMzY1Mjc1NGM2MTBkMDgzNzlkZmRjZTllNWYxMzQ1MWE5Mg==
4
+ MzdjNjY4ZGZiYmQyMjFjMDA2YzU0MDI0NjkwNmUxYTNmMDg2OTUwOA==
5
5
  data.tar.gz: !binary |-
6
- MzljODgxYWQ1YjhkOWZlZGVhZWViNzhhMzFlYjlhYTdjZmZiNjUyNg==
6
+ Yjc2ZGE3ZGNlZGQ3YTU4ODkzMDNmMDc1OTlmMjgzNjUzMWZiMWEwYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTU3OTk2ZjUxZTU1NTE2NGM0MTBhNjMzYTAxNjY3MzdhNTJiN2FlZmQzZDg3
10
- NTI1Y2I2MDkzZmIwZDVmYzUzOTY1Y2U4YzY3MzkzNWJjOWI5YTVhNWRiNzQw
11
- OWJmM2E1NjFkYTQ3ZDljNjZlZmExOWQ5Y2FmYTI3YTg4MThkMDM=
9
+ YWUzMDg0ZTYxY2M5NTQ0Y2U5NDVmZGY4NzFiYThmMDcwZTQxNDM5ZjI3ODg0
10
+ YTZkNTdlY2JmYTI1ZDcyMTgxZjJlZDZjNTZjOGQxNDMyZDQ1OTVlMzFmZjll
11
+ ZWRlMDljYjlmYzRmNDlhN2YxM2VhOGIxNDQ1Zjk0NjViOWVmOTY=
12
12
  data.tar.gz: !binary |-
13
- MTJmNWIxZWNiOGUxODI0N2MwYjE1OGVlNmZjYThmYjlkMDM0Yzg0MDQyZmNj
14
- NTRiNGMxNmM0M2Y1ZDVhZGFjYTMxZGZkMzI2NjFlMTc0ZTk0ODdlYmFmNzU2
15
- YjU4OWJmZDM3NDI5MWUwODFmYjBjN2M5NzNjODFlMzZkYjNmMDQ=
13
+ YWUyYmI4Yjc2YmNiNDY4ZDhlNzYxZmVhZGQ3MmQwZDRjYjIzNjExN2RiODlh
14
+ MGM5YzQ0MDk3YjFhNGYxZTg2ZGM0MTlmZGQ5MmUxMTBjZDZjMTJmM2U0NWRk
15
+ M2M3OGVlM2Y1ZmRkNzNjNWZjNDFlNTNiMDQ2ZGY5ZjMxNmYzMDE=
data/HISTORY.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 3.0 - February 15, 2014
2
+
3
+ - Major/minor bump because of breaking API changes to `Elasticity::BootstrapAction` due to [Issue #55](https://github.com/rslifka/elasticity/issues/55). After spending some time deprecating, I realized I don't have the code bandwidth to do it in a way that I would be happy with. Move fast and break things ;)
4
+ - Dev update: Added `Elasticity::EMR#describe_jobflow_xml` to assist in job flow debugging.
5
+
1
6
  ## 2.7 - December 4, 2013
2
7
 
3
8
  - `Elasticity::S3DistCp` and `Elasticity::ScriptStep` added to provide easy access to remote copying and arbitrary script execution.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/elasticity.png)](http://badge.fury.io/rb/elasticity)
2
2
 
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!
3
+ **(February 15, 2014)** 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
 
@@ -20,7 +20,7 @@ gem install elasticity
20
20
  or in your Gemfile
21
21
 
22
22
  ```
23
- gem 'elasticity', '~> 2.7'
23
+ gem 'elasticity', '~> 3.0'
24
24
  ```
25
25
 
26
26
  This will ensure that you protect yourself from API changes, which will only be made in major revisions.
@@ -3,27 +3,26 @@ module Elasticity
3
3
  class BootstrapAction
4
4
 
5
5
  attr_accessor :name
6
- attr_accessor :option
7
- attr_accessor :value
8
6
  attr_accessor :script
7
+ attr_accessor :arguments
9
8
 
10
- def initialize(script, option, value)
9
+ def initialize(script, *bootstrap_arguments)
11
10
  @name = 'Elasticity Bootstrap Action'
12
- @option = option
13
- @value = value
14
11
  @script = script
12
+ @arguments = bootstrap_arguments
15
13
  end
16
14
 
17
15
  def to_aws_bootstrap_action
18
- {
16
+ action = {
19
17
  :name => @name,
20
18
  :script_bootstrap_action => {
21
- :path => @script,
22
- :args => [@option, @value]
19
+ :path => @script
23
20
  }
24
21
  }
22
+ action[:script_bootstrap_action].merge!(:args => @arguments) unless @arguments.empty?
23
+ action
25
24
  end
26
25
 
27
26
  end
28
27
 
29
- end
28
+ end
@@ -24,6 +24,15 @@ module Elasticity
24
24
  JobFlowStatus.from_members_nodeset(xml_doc.xpath('/DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows/member')).first
25
25
  end
26
26
 
27
+ # This is primarily for debugging purposes, providing insight into how
28
+ # Amazon internally represents jobs. It's used to reverse-engineer
29
+ # how API calls construct jobflows.
30
+ def describe_jobflow_xml(jobflow_id)
31
+ describe_jobflow(jobflow_id) do |xml|
32
+ return xml
33
+ end
34
+ end
35
+
27
36
  # Lists all jobflows in all states.
28
37
  #
29
38
  # To override this behaviour, pass additional filters as specified in the AWS
@@ -3,10 +3,8 @@ module Elasticity
3
3
  class HadoopBootstrapAction < BootstrapAction
4
4
 
5
5
  def initialize(option, value)
6
- @name = 'Elasticity Bootstrap Action (Configure Hadoop)'
7
- @option = option
8
- @value = value
9
- @script = 's3n://elasticmapreduce/bootstrap-actions/configure-hadoop'
6
+ super('s3n://elasticmapreduce/bootstrap-actions/configure-hadoop', option, value)
7
+ self.name = 'Elasticity Bootstrap Action (Configure Hadoop)'
10
8
  end
11
9
 
12
10
  end
@@ -3,10 +3,8 @@ module Elasticity
3
3
  class HadoopFileBootstrapAction < BootstrapAction
4
4
 
5
5
  def initialize(config_file)
6
- @name = 'Elasticity Bootstrap Action (Configure Hadoop via File)'
7
- @option = '--mapred-config-file'
8
- @value = config_file
9
- @script = 's3n://elasticmapreduce/bootstrap-actions/configure-hadoop'
6
+ super('s3n://elasticmapreduce/bootstrap-actions/configure-hadoop', '--mapred-config-file', config_file)
7
+ self.name = 'Elasticity Bootstrap Action (Configure Hadoop via File)'
10
8
  end
11
9
 
12
10
  end
@@ -1,3 +1,3 @@
1
1
  module Elasticity
2
- VERSION = '2.7'
2
+ VERSION = '3.0'
3
3
  end
@@ -1,25 +1,41 @@
1
1
  describe Elasticity::BootstrapAction do
2
2
 
3
3
  subject do
4
- Elasticity::BootstrapAction.new('script', 'option', 'value')
4
+ Elasticity::BootstrapAction.new('script', 'arg1', 'arg2')
5
5
  end
6
6
 
7
7
  its(:name) { should == 'Elasticity Bootstrap Action' }
8
- its(:option) { should == 'option' }
9
- its(:value) { should == 'value' }
10
8
  its(:script) { should == 'script' }
9
+ its(:arguments) { should == %w(arg1 arg2) }
11
10
 
12
11
  describe '#to_aws_bootstrap_action' do
13
- it 'should create a bootstrap action' do
14
- subject.to_aws_bootstrap_action.should ==
15
- {
16
- :name => 'Elasticity Bootstrap Action',
17
- :script_bootstrap_action => {
18
- :path => 'script',
19
- :args => %w(option value)
20
- }
12
+
13
+ let(:aws_bootstrap_step) {
14
+ {
15
+ :name => 'Elasticity Bootstrap Action',
16
+ :script_bootstrap_action => {
17
+ :path => 'script'
21
18
  }
19
+ }
20
+ }
21
+
22
+ context 'when there are no arguments' do
23
+ let(:bootstrap_action) { Elasticity::BootstrapAction.new('script') }
24
+ it 'should create a proper bootstrap action' do
25
+ expect(bootstrap_action.to_aws_bootstrap_action).to eq(aws_bootstrap_step)
26
+ end
22
27
  end
28
+
29
+ context 'when there are arguments' do
30
+ let(:bootstrap_action) { Elasticity::BootstrapAction.new('script', 'arg1', 'arg2') }
31
+ before do
32
+ aws_bootstrap_step[:script_bootstrap_action][:args] = %w(arg1 arg2)
33
+ end
34
+ it 'should create a proper bootstrap action' do
35
+ expect(subject.to_aws_bootstrap_action).to be_a_hash_including(aws_bootstrap_step)
36
+ end
37
+ end
38
+
23
39
  end
24
40
 
25
41
  end
@@ -203,6 +203,18 @@ describe Elasticity::EMR do
203
203
  end
204
204
  end
205
205
 
206
+ describe '#describe_jobflow_xml' do
207
+
208
+ before do
209
+ subject.should_receive(:describe_jobflow).with('JOBFLOW_ID').and_yield('XML_RESULT')
210
+ end
211
+
212
+ it 'should describe the specified jobflow via raw xml text' do
213
+ subject.describe_jobflow_xml('JOBFLOW_ID').should == 'XML_RESULT'
214
+ end
215
+
216
+ end
217
+
206
218
  describe '#modify_instance_groups' do
207
219
 
208
220
  it 'should modify the specified instance groups' do
@@ -7,8 +7,7 @@ describe Elasticity::HadoopBootstrapAction do
7
7
  it { should be_a Elasticity::BootstrapAction }
8
8
 
9
9
  its(:name) { should == 'Elasticity Bootstrap Action (Configure Hadoop)' }
10
- its(:option) { should == 'option' }
11
- its(:value) { should == 'value' }
10
+ its(:arguments) { should == %w(option value) }
12
11
  its(:script) { should == 's3n://elasticmapreduce/bootstrap-actions/configure-hadoop' }
13
12
 
14
13
  end
@@ -7,8 +7,7 @@ describe Elasticity::HadoopFileBootstrapAction do
7
7
  it { should be_a Elasticity::BootstrapAction }
8
8
 
9
9
  its(:name) { should == 'Elasticity Bootstrap Action (Configure Hadoop via File)' }
10
- its(:option) { should == '--mapred-config-file' }
11
- its(:value) { should == 'config_file' }
10
+ its(:arguments) { should == %w(--mapred-config-file config_file) }
12
11
  its(:script) { should == 's3n://elasticmapreduce/bootstrap-actions/configure-hadoop' }
13
12
 
14
13
  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.7'
4
+ version: '3.0'
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-12-04 00:00:00.000000000 Z
11
+ date: 2014-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client