bricolage 5.18.0 → 5.18.1

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: 12e309ad5b258e1f273a35fb9b71e8f556501555
4
- data.tar.gz: 861d23ff01a1b07c4c97c8f4f8cce26ac50a8a0f
3
+ metadata.gz: 9d53e1ef12fa46e40f582c88a0c6e7160e9f5289
4
+ data.tar.gz: fdf237fc9cf155993e97e3fd49e056caf61caa1b
5
5
  SHA512:
6
- metadata.gz: f70ce6284e2e5c0e5b8d5b101dd6b1ea79545aeee2cb97970aa499107a75dd86326526f4ad3c6adcf9ceea29926e1ba8b3d84733f6055a3fe6430c19725ef36c
7
- data.tar.gz: e4d2b5141b3afabe8d5e93b559876c637382f2d4b53b614bb2476f5e7c62329db18c3e90e21e60d2b60ae158aeb7b9a3cc06e244bf86b01bbd0aa1c13aa7a45c
6
+ metadata.gz: 63bd4a335142ce2ff1d0aef8cf96999367919afea579655556654e6ffd22aa09554f613b5212e3ef066fcd68add40f8c39ff5e1aa2a9cf6a90f6038123fba100
7
+ data.tar.gz: b2efecf9474c6ffc6d2809aa523cfd7a2df1ca4c303116eb5d9c540fe3c2b1f0ba9e45b6834313d6067b2506d734d362706592d80109ea50f94b3933b30ed107
@@ -30,6 +30,12 @@ module Bricolage
30
30
  # Aquiring lock takes too long (e.g. VACUUM lock)
31
31
  class LockTimeout < JobFailure; end
32
32
 
33
+ # S3 related exceptions
34
+ class S3Exception < JobFailureByException; end
35
+
36
+ # SNS related exceptions
37
+ class SNSException < JobFailureByException; end
38
+
33
39
  # Job error.
34
40
  # This exception should NOT be thrown in production environment.
35
41
  # You must fix source code or configuration not to be get this exception.
@@ -2,7 +2,9 @@ require 'stringio'
2
2
  require 'logger'
3
3
 
4
4
  module Bricolage
5
+
5
6
  class Logger < ::Logger
7
+
6
8
  def Logger.intern_severity(sev)
7
9
  if sev.kind_of?(Integer)
8
10
  sev
@@ -63,5 +65,24 @@ module Bricolage
63
65
  "%.2f secs" % seconds
64
66
  end
65
67
  end
68
+
66
69
  end
67
- end
70
+
71
+
72
+ class NullLogger
73
+ def debug(*args) end
74
+ def debug?() false end
75
+ def info(*args) end
76
+ def info?() false end
77
+ def warn(*args) end
78
+ def warn?() false end
79
+ def error(*args) end
80
+ def error?() false end
81
+ def exception(*args) end
82
+ def with_elapsed_time(*args) yield end
83
+ def elapsed_time(*args) yield end
84
+ def level() Logger::ERROR end
85
+ def level=(l) l end
86
+ end
87
+
88
+ end # module Bricolage
@@ -0,0 +1,40 @@
1
+ require 'bricolage/datasource'
2
+ require 'aws-sdk'
3
+
4
+ module Bricolage
5
+
6
+ class SNSDataSource < DataSource
7
+
8
+ declare_type 'sns'
9
+
10
+ def initialize(region:, topic_arn:, access_key_id: nil, secret_access_key: nil)
11
+ @region = region
12
+ @topic_arn = topic_arn
13
+ @access_key_id = access_key_id
14
+ @secret_access_key = secret_access_key
15
+ @client = Aws::SNS::Client.new(region: region, access_key_id: access_key_id, secret_access_key: secret_access_key)
16
+ @topic = Aws::SNS::Topic.new(topic_arn, client: @client)
17
+ end
18
+
19
+ attr_reader :region
20
+ attr_reader :client
21
+ attr_reader :topic
22
+
23
+ def publish(message)
24
+ @topic.publish({ message: message })
25
+ rescue Aws::SNS::Errors::InvalidParameter => ex
26
+ raise JobError, "bad SNS configuration (topic_arn=#{@topic_arn.inspect}): #{ex.message}"
27
+ rescue Aws::SNS::Errors::ServiceError => ex
28
+ raise SNSException.wrap(ex)
29
+ end
30
+
31
+ # IO compatible methods as a logger device
32
+
33
+ alias write publish
34
+
35
+ def close
36
+ end
37
+
38
+ end # class SNSDataSource
39
+
40
+ end # module Bricolage
@@ -1,4 +1,4 @@
1
1
  module Bricolage
2
2
  APPLICATION_NAME = 'Bricolage'
3
- VERSION = '5.18.0'
3
+ VERSION = '5.18.1'
4
4
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- bricolage (5.18.0)
4
+ bricolage (5.18.1)
5
5
  aws-sdk (~> 2)
6
6
  mysql2
7
7
  pg (~> 0.18.0)
@@ -11,12 +11,12 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- aws-sdk (2.6.4)
15
- aws-sdk-resources (= 2.6.4)
16
- aws-sdk-core (2.6.4)
14
+ aws-sdk (2.6.7)
15
+ aws-sdk-resources (= 2.6.7)
16
+ aws-sdk-core (2.6.7)
17
17
  jmespath (~> 1.0)
18
- aws-sdk-resources (2.6.4)
19
- aws-sdk-core (= 2.6.4)
18
+ aws-sdk-resources (2.6.7)
19
+ aws-sdk-core (= 2.6.7)
20
20
  coderay (1.1.0)
21
21
  fluent-logger (0.5.1)
22
22
  msgpack (>= 0.4.4, < 0.6.0, != 0.5.3, != 0.5.2, != 0.5.1, != 0.5.0)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bricolage
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.18.0
4
+ version: 5.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minero Aoki
@@ -182,6 +182,7 @@ files:
182
182
  - lib/bricolage/rubyjobclass.rb
183
183
  - lib/bricolage/s3datasource.rb
184
184
  - lib/bricolage/script.rb
185
+ - lib/bricolage/snsdatasource.rb
185
186
  - lib/bricolage/sqlstatement.rb
186
187
  - lib/bricolage/sqlutils.rb
187
188
  - lib/bricolage/taskqueue.rb