aws_pipes 0.0.4 → 0.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.
Files changed (3) hide show
  1. data/bin/aws_db +19 -7
  2. data/lib/aws_pipes/version.rb +1 -1
  3. metadata +2 -2
data/bin/aws_db CHANGED
@@ -31,13 +31,25 @@ db = AWS::DynamoDB.new(
31
31
  :secret_access_key => AwsPipes.secret_access_key(opts)
32
32
  )
33
33
 
34
- begin
35
- $stdin.sync = true
36
- table = db.tables[table_name]
37
- table.load_schema
38
- while row = $stdin.gets
34
+ $stdin.sync = true
35
+ table = db.tables[table_name]
36
+ table.load_schema
37
+
38
+ while row = $stdin.gets
39
+ begin
39
40
  table.items.create Hash[col_names.zip(row.split "\t")]
41
+ rescue AWS::DynamoDB::Errors::ProvisionedThroughputExceededException
42
+ new_write_capacity = table.write_capacity_units * 2
43
+ warn "Exceeded provisioned throughput for table #{table_name}."
44
+ warn "Increasing write capacity to #{new_write_capacity}."
45
+ begin
46
+ table.provision_throughput :write_capacity_units => new_write_capacity
47
+ rescue AWS::DynamoDB::Errors::ResourceInUseException
48
+ # throughput provisioning in progress, give it time
49
+ sleep 10
50
+ end
51
+ retry
52
+ rescue Interrupt
53
+ exit 0
40
54
  end
41
- rescue Interrupt
42
- exit 0
43
55
  end
@@ -1,3 +1,3 @@
1
1
  module AwsPipes
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_pipes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-27 00:00:00.000000000 Z
12
+ date: 2012-12-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk