elasticity 6.0.8 → 6.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3cd50c2b68572e1a5e546d3ff07e49e040b60a92
4
- data.tar.gz: cfda4f23570cb4206835b9e4e6366807d7ab2f4c
3
+ metadata.gz: b5a420f1b650e0fa6585fd2920421cfd6b486644
4
+ data.tar.gz: 1154a380992793fe9df9547595563066f8c0b6e7
5
5
  SHA512:
6
- metadata.gz: c61bae14a944d248c96cf45bb522de9bf611bcad24599d158fed27003f2d1c164afb58451fba87c62e55b68fc10f05ab0dc28df49b1b9fc0ca9b6433aaedb231
7
- data.tar.gz: 25c6be356bf71593510bca93f8f327c8f5162ade323d15bf4fca7e68c5ef9a2017050de7307add76a930808e4f8c3706b9327a267356029df4d5aaa21b54d978
6
+ metadata.gz: 81cb07a81d797dee5892a142d09ae459d4cefd0796407f0b509787db1b3aa0174bdd9290d329780659f0cdf41c7e8d732076640cd628a86d9e44b9c14671ae40
7
+ data.tar.gz: 81c09d734cea32f997f68932d0e36aa1fb0d11ee62b1ae46560334392dccc4e433094930de311d6f29fa1bb6ec920e801b1b62bdd95ee8c9570a3f26dcdd6a8a
data/.travis.yml CHANGED
@@ -1,7 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0
4
- - 2.1
5
3
  - 2.2
6
4
  - 2.3.0
7
5
  before_install:
data/HISTORY.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 6.0.9 - December 20, 2016
2
+
3
+ - Including PR [#130](https://github.com/rslifka/elasticity/pull/130) - "AAdd support for EBS". Thank you [@jbeemster](https://github.com/jbeemster)!
4
+ - Including PR [#131](https://github.com/rslifka/elasticity/pull/131) - "Deprecated Support for Ruby <= 2.2".
5
+
1
6
  ## 6.0.8 - February 22, 2016
2
7
 
3
8
  - Including PR [#126](https://github.com/rslifka/elasticity/pull/126) - "Add support for additional security groups". Thank you [@alistair](https://github.com/alistair)!
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  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.
4
4
 
5
- [![Build Status](https://secure.travis-ci.org/rslifka/elasticity.png)](http://travis-ci.org/rslifka/elasticity) 2.0.x, 2.1.x, 2.2.x, 2.3.x
5
+ [![Build Status](https://secure.travis-ci.org/rslifka/elasticity.png)](http://travis-ci.org/rslifka/elasticity) 2.2.x, 2.3.x
6
6
 
7
7
  Elasticity provides two ways to access EMR:
8
8
 
@@ -10,6 +10,7 @@ Elasticity provides two ways to access EMR:
10
10
  * **Directly through access to the EMR REST API**. The less-discussed hidden darkside... I use this to enable the Elasticity API. RubyDoc can be found at the RubyGems [auto-generated documentation site](http://rubydoc.info/gems/elasticity/frames). Be forewarned: Making the calls directly requires that you understand how to structure EMR requests at the Amazon API level and from experience I can tell you there are more fun things you could be doing :) Scroll to the end for more information on the Amazon API.
11
11
 
12
12
  # Installation
13
+ You must be running a ruby >= 2.2
13
14
 
14
15
  ```
15
16
  gem install elasticity
data/elasticity.gemspec CHANGED
@@ -3,13 +3,14 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
  require 'elasticity/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = 'elasticity'
7
- s.version = Elasticity::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ['Robert Slifka']
10
- s.homepage = 'http://www.github.com/rslifka/elasticity'
11
- s.summary = %q{Streamlined, programmatic access to Amazon's Elastic Map Reduce service.}
12
- s.description = %q{Streamlined, programmatic access to Amazon's Elastic Map Reduce service, driven by the Sharethrough team's requirements for belting out EMR jobs.}
6
+ s.name = 'elasticity'
7
+ s.version = Elasticity::VERSION
8
+ s.required_ruby_version = '>= 2.2'
9
+ s.platform = Gem::Platform::RUBY
10
+ s.authors = ['Robert Slifka']
11
+ s.homepage = 'http://www.github.com/rslifka/elasticity'
12
+ s.summary = %q{Streamlined, programmatic access to Amazon's Elastic Map Reduce service.}
13
+ s.description = %q{Streamlined, programmatic access to Amazon's Elastic Map Reduce service, driven by the Sharethrough team's requirements for belting out EMR jobs.}
13
14
 
14
15
  s.add_dependency('rest-client', '~> 1.0')
15
16
  s.add_dependency('fog', '~> 1.0')
@@ -8,6 +8,7 @@ module Elasticity
8
8
  attr_accessor :type
9
9
  attr_accessor :role
10
10
 
11
+ attr_reader :ebs_configuration
11
12
  attr_reader :bid_price
12
13
  attr_reader :market
13
14
 
@@ -49,6 +50,12 @@ module Elasticity
49
50
  @market = 'ON_DEMAND'
50
51
  end
51
52
 
53
+ def set_ebs_configuration(ebs_configuration)
54
+ if ebs_configuration.is_a?(Elasticity::EbsConfiguration)
55
+ @ebs_configuration = ebs_configuration
56
+ end
57
+ end
58
+
52
59
  def to_aws_instance_config
53
60
  {
54
61
  :market => @market,
@@ -57,9 +64,64 @@ module Elasticity
57
64
  :instance_role => @role,
58
65
  }.tap do |config|
59
66
  config.merge!(:bid_price => @bid_price) if @market == 'SPOT'
67
+ config.merge!(:ebs_configuration => @ebs_configuration.to_aws_ebs_config) if @ebs_configuration != nil
60
68
  end
61
69
  end
62
70
 
63
71
  end
64
72
 
73
+ class EbsConfiguration
74
+
75
+ attr_accessor :ebs_optimized
76
+
77
+ attr_reader :ebs_block_device_configs
78
+
79
+ def initialize
80
+ @ebs_optimized = false
81
+ @ebs_block_device_configs = Array.new
82
+ end
83
+
84
+ def add_ebs_block_device_config(ebs_block_device_config)
85
+ if ebs_block_device_config.is_a?(Elasticity::EbsBlockDeviceConfig)
86
+ @ebs_block_device_configs.push(ebs_block_device_config)
87
+ end
88
+ end
89
+
90
+ def to_aws_ebs_config
91
+ {
92
+ :ebs_optimized => @ebs_optimized,
93
+ :ebs_block_device_configs => @ebs_block_device_configs.map {
94
+ |i| i.to_aws_ebs_block_device_config
95
+ }
96
+ }
97
+ end
98
+ end
99
+
100
+ class EbsBlockDeviceConfig
101
+
102
+ attr_accessor :volume_type
103
+ attr_accessor :iops
104
+ attr_accessor :size_in_gb
105
+ attr_accessor :volumes_per_instance
106
+
107
+ def initialize
108
+ @volume_type = "gp2"
109
+ @iops = 1
110
+ @size_in_gb = 1
111
+ @volumes_per_instance = 1
112
+ end
113
+
114
+ def to_aws_ebs_block_device_config
115
+ {
116
+ :volume_specification => {
117
+ :volume_type => @volume_type,
118
+ :size_in_gb => @size_in_gb,
119
+ }.tap do |spec|
120
+ spec.merge!(:iops => @iops) if @volume_type == "io1"
121
+ end,
122
+ :volumes_per_instance => @volumes_per_instance
123
+ }
124
+ end
125
+ end
126
+
65
127
  end
@@ -133,6 +133,18 @@ module Elasticity
133
133
  @instance_groups[:task] = instance_group
134
134
  end
135
135
 
136
+ def set_master_ebs_configuration(ebs_configuration)
137
+ @instance_groups[:master].set_ebs_configuration(ebs_configuration)
138
+ end
139
+
140
+ def set_core_ebs_configuration(ebs_configuration)
141
+ @instance_groups[:core].set_ebs_configuration(ebs_configuration)
142
+ end
143
+
144
+ def set_task_ebs_configuration(ebs_configuration)
145
+ @instance_groups[:task].set_ebs_configuration(ebs_configuration)
146
+ end
147
+
136
148
  def add_step(jobflow_step)
137
149
  if is_jobflow_running?
138
150
  jobflow_steps = []
@@ -1,3 +1,3 @@
1
1
  module Elasticity
2
- VERSION = '6.0.8'
2
+ VERSION = '6.0.9'
3
3
  end
@@ -123,7 +123,7 @@ describe Elasticity::AwsRequestV4 do
123
123
 
124
124
  describe '.aws_v4_signature' do
125
125
  it 'should create the proper signature' do
126
- subject.send(:aws_v4_signature).should == '8cd99127235ec8f7c9304ad55d1ef702c556d1d5169dd2d224e6cf86fe179f1e'
126
+ subject.send(:aws_v4_signature).should == 'aee8cb25939b4262213612d3410b3033107f97134beadc91563b532c54cf3ab3'
127
127
  end
128
128
  end
129
129
 
@@ -7,6 +7,7 @@ describe Elasticity::InstanceGroup do
7
7
  expect(subject.type).to eql('m1.small')
8
8
  expect(subject.market).to eql('ON_DEMAND')
9
9
  expect(subject.role).to eql('CORE')
10
+ expect(subject.ebs_configuration).to eql(nil)
10
11
  end
11
12
  end
12
13
 
@@ -98,6 +99,20 @@ describe Elasticity::InstanceGroup do
98
99
 
99
100
  end
100
101
 
102
+ describe '#set_ebs_configuration' do
103
+
104
+ it 'should not change if the type is incorrect' do
105
+ subject.set_ebs_configuration("ebs_configuration")
106
+ subject.ebs_configuration.should == nil
107
+ end
108
+
109
+ it 'should change if the type is correct' do
110
+ subject.set_ebs_configuration(Elasticity::EbsConfiguration.new)
111
+ subject.ebs_configuration.should_not == nil
112
+ end
113
+
114
+ end
115
+
101
116
  describe '#to_aws_instance_config' do
102
117
 
103
118
  context 'when an ON_DEMAND group' do
@@ -139,6 +154,58 @@ describe Elasticity::InstanceGroup do
139
154
  end
140
155
  end
141
156
 
157
+ context 'when a EBS configuration' do
158
+ let(:on_demand_instance_group) do
159
+ Elasticity::InstanceGroup.new.tap do |i|
160
+ i.count = 5
161
+ i.type = 'c1.medium'
162
+ i.role = 'CORE'
163
+ i.set_ebs_configuration(
164
+ Elasticity::EbsConfiguration.new.tap do |ebs|
165
+ ebs.add_ebs_block_device_config(Elasticity::EbsBlockDeviceConfig.new)
166
+ ebs.add_ebs_block_device_config(
167
+ Elasticity::EbsBlockDeviceConfig.new.tap do |ebsc|
168
+ ebsc.size_in_gb = 10000
169
+ ebsc.volumes_per_instance = 10
170
+ ebsc.iops = 9999
171
+ ebsc.volume_type = "io1"
172
+ end
173
+ )
174
+ end
175
+ )
176
+ end
177
+ end
178
+ it 'should generate an AWS config' do
179
+ on_demand_instance_group.ebs_configuration.ebs_block_device_configs.length.should == 2
180
+ on_demand_instance_group.to_aws_instance_config.should == {
181
+ :market => 'ON_DEMAND',
182
+ :instance_count => 5,
183
+ :instance_type => 'c1.medium',
184
+ :instance_role => 'CORE',
185
+ :ebs_configuration => {
186
+ :ebs_block_device_configs => [
187
+ {
188
+ :volume_specification => {
189
+ :volume_type => "gp2",
190
+ :size_in_gb => 1,
191
+ },
192
+ :volumes_per_instance => 1
193
+ },
194
+ {
195
+ :volume_specification => {
196
+ :volume_type => "io1",
197
+ :iops => 9999,
198
+ :size_in_gb => 10000,
199
+ },
200
+ :volumes_per_instance => 10
201
+ },
202
+ ],
203
+ :ebs_optimized => false,
204
+ },
205
+ }
206
+ end
207
+ end
208
+
142
209
  end
143
210
 
144
211
  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: 6.0.8
4
+ version: 6.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Slifka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-21 00:00:00.000000000 Z
11
+ date: 2016-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -206,7 +206,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
206
206
  requirements:
207
207
  - - ">="
208
208
  - !ruby/object:Gem::Version
209
- version: '0'
209
+ version: '2.2'
210
210
  required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  requirements:
212
212
  - - ">="