elasticity 6.0.4 → 6.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/HISTORY.md +4 -0
- data/lib/elasticity/aws_session.rb +10 -6
- data/lib/elasticity/version.rb +1 -1
- data/spec/lib/elasticity/aws_request_v4_spec.rb +1 -1
- data/spec/lib/elasticity/aws_session_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d313d736b8c2be8bda97c7cba0c200c611b5fc59
|
4
|
+
data.tar.gz: e0c4afadd4d192770e3c79a67f5c62147425c1dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c3c35bdeb9408756f085cc9fc8550c6ca6165fec7134af6a8f639279128cb6bf2a84a067766891ead282e6532adbb5a1a2fa7aff6fa62ed65261171f8fb7f80
|
7
|
+
data.tar.gz: cbab3121a67c1b7f0d3370f6ee662b7dd308fa0d8c57122e68db1f2b0b1e5a87119533968baadfae8c3e4a5bbd76a94ae28a49f362e276fb42d68e34e9d58e8f
|
data/.gitignore
CHANGED
data/HISTORY.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 6.0.5 - August 28, 2015
|
2
|
+
|
3
|
+
- - Including PR [#119](https://github.com/rslifka/elasticity/pull/119) - "Error handling for API rate limiting". Thank you [@robert2d](https://github.com/robert2d)!
|
4
|
+
|
1
5
|
## 6.0.4 - August 3, 2015
|
2
6
|
|
3
7
|
- Including PR [#118](https://github.com/rslifka/elasticity/pull/118) - "jobflow ids must be passed as an array to AWS". Thank you [@robert2d](https://github.com/robert2d)!
|
@@ -1,9 +1,8 @@
|
|
1
1
|
module Elasticity
|
2
2
|
|
3
|
-
class MissingKeyError < StandardError;
|
4
|
-
end
|
5
|
-
class
|
6
|
-
end
|
3
|
+
class MissingKeyError < StandardError; end
|
4
|
+
class MissingRegionError < StandardError; end
|
5
|
+
class ThrottlingException < StandardError; end
|
7
6
|
|
8
7
|
class AwsSession
|
9
8
|
|
@@ -29,7 +28,9 @@ module Elasticity
|
|
29
28
|
begin
|
30
29
|
RestClient.post(aws_request.url, aws_request.payload, aws_request.headers)
|
31
30
|
rescue RestClient::BadRequest => e
|
32
|
-
|
31
|
+
type, message = AwsSession.parse_error_response(e.http_body)
|
32
|
+
raise ThrottlingException, message if type == 'ThrottlingException'
|
33
|
+
raise ArgumentError, message
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
@@ -45,7 +46,10 @@ module Elasticity
|
|
45
46
|
# the error document.
|
46
47
|
def self.parse_error_response(error_json)
|
47
48
|
error = JSON.parse(error_json)
|
48
|
-
|
49
|
+
[
|
50
|
+
error['__type'],
|
51
|
+
"AWS EMR API Error (#{error['__type']}): #{error['message']}"
|
52
|
+
]
|
49
53
|
end
|
50
54
|
|
51
55
|
end
|
data/lib/elasticity/version.rb
CHANGED
@@ -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 == '
|
126
|
+
subject.send(:aws_v4_signature).should == '107261f2d6a4d5caa0b14c6be4aabd283f730ce11f1e855890553288b21e1f5a'
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -94,6 +94,16 @@ describe Elasticity::AwsSession do
|
|
94
94
|
subject.submit({})
|
95
95
|
}.to raise_error(ArgumentError, "AWS EMR API Error (#{error_type}): #{error_message}")
|
96
96
|
end
|
97
|
+
|
98
|
+
context 'EMR API rate limit hit' do
|
99
|
+
let(:error_type) { 'ThrottlingException' }
|
100
|
+
it 'should raise a Throttling error with the body of the error' do
|
101
|
+
RestClient.should_receive(:post).and_raise(error)
|
102
|
+
expect {
|
103
|
+
subject.submit({})
|
104
|
+
}.to raise_error(Elasticity::ThrottlingException, "AWS EMR API Error (#{error_type}): #{error_message}")
|
105
|
+
end
|
106
|
+
end
|
97
107
|
end
|
98
108
|
|
99
109
|
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.
|
4
|
+
version: 6.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Slifka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|