bricolage-streamingload 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/send-checkpoint-event +9 -0
- data/bin/send-data-event +36 -0
- data/bin/send-load-task +13 -0
- data/bin/send-shutdown-event +9 -0
- data/lib/bricolage/sqsdatasource.rb +26 -1
- data/lib/bricolage/streamingload/version.rb +1 -1
- metadata +20 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e6fd594b56fc33bc988e905de9cba98cd9c6c6e
|
4
|
+
data.tar.gz: 5379c4bee784641b7231b6c04a7ad81262943650
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 478636bb27db1be56dccce73424bdbe9d49ee66b50218f1ad7e416e6bffc7a1d59a8f715f2e12e7603e35c71a0d1f8f5dae7f20bfc78d0b7db24eb1d2649108a
|
7
|
+
data.tar.gz: 5600a8e5883aab13f05cd2386bb416d92bb36dfd716843f26d869db8dcad3d363fdf540d58daac74d65819005cf1f8f21b6234eaf78b957bcd67cecd2eef71d9
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bricolage/commandlineapplication'
|
4
|
+
|
5
|
+
app = Bricolage::CommandLineApplication.define {|opts|
|
6
|
+
opts.data_source_option('--queue-ds', 'Target queue data soure.', short: '-D', kind: 'sqs')
|
7
|
+
}
|
8
|
+
queue = app.data_source('--queue-ds')
|
9
|
+
queue.send_event('checkpoint')
|
data/bin/send-data-event
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bricolage/commandlineapplication'
|
4
|
+
|
5
|
+
no_dispatch = false
|
6
|
+
app = Bricolage::CommandLineApplication.define {|opts|
|
7
|
+
opts.data_source_option('--queue-ds', 'Target queue data soure.', short: '-D', kind: 'sqs')
|
8
|
+
opts.on('--no-dispatch', 'Turn off dispatch flag.') {
|
9
|
+
no_dispatch = true
|
10
|
+
}
|
11
|
+
}
|
12
|
+
queue = app.data_source('--queue-ds')
|
13
|
+
|
14
|
+
ARGF.each do |line|
|
15
|
+
url = line.strip
|
16
|
+
bucket, key = url.sub(%r<s3://>, '').split('/', 2)
|
17
|
+
$stderr.puts "PUT bucket=#{bucket} key=#{key}"
|
18
|
+
queue.send_event(
|
19
|
+
"ObjectCreated:Put",
|
20
|
+
eventVersion: "2.0",
|
21
|
+
awsRegion: queue.region,
|
22
|
+
s3: {
|
23
|
+
s3SchemaVersion: "1.0",
|
24
|
+
configurationId: "LogStreamDev",
|
25
|
+
bucket: {
|
26
|
+
name: bucket,
|
27
|
+
arn: "arn:aws:s3:::#{bucket}"
|
28
|
+
},
|
29
|
+
object: {
|
30
|
+
key: key,
|
31
|
+
size: 1
|
32
|
+
}
|
33
|
+
},
|
34
|
+
noDispatch: no_dispatch
|
35
|
+
)
|
36
|
+
end
|
data/bin/send-load-task
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bricolage/commandlineapplication'
|
4
|
+
|
5
|
+
app = Bricolage::CommandLineApplication.define {|opts|
|
6
|
+
opts.data_source_option('--queue-ds', 'Target queue data soure.', short: '-D', kind: 'sqs')
|
7
|
+
}
|
8
|
+
queue = app.data_source('--queue-ds')
|
9
|
+
|
10
|
+
ARGF.each do |line|
|
11
|
+
task_id = line.strip
|
12
|
+
queue.send_event('streaming_load_v3', taskId: task_id)
|
13
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bricolage/commandlineapplication'
|
4
|
+
|
5
|
+
app = Bricolage::CommandLineApplication.define {|opts|
|
6
|
+
opts.data_source_option('--queue-ds', 'Target queue data soure.', short: '-D', kind: 'sqs')
|
7
|
+
}
|
8
|
+
queue = app.data_source('--queue-ds')
|
9
|
+
queue.send_event('shutdown')
|
@@ -10,7 +10,7 @@ module Bricolage
|
|
10
10
|
|
11
11
|
declare_type 'sqs'
|
12
12
|
|
13
|
-
def initialize(region: 'ap-northeast-1', url:, access_key_id
|
13
|
+
def initialize(region: 'ap-northeast-1', url:, access_key_id: nil, secret_access_key: nil,
|
14
14
|
visibility_timeout:, max_number_of_messages: 10, wait_time_seconds: 20, noop: false)
|
15
15
|
@region = region
|
16
16
|
@url = url
|
@@ -170,6 +170,17 @@ module Bricolage
|
|
170
170
|
)
|
171
171
|
end
|
172
172
|
|
173
|
+
def send_object(obj)
|
174
|
+
send_message(ObjectMessage.new(obj))
|
175
|
+
end
|
176
|
+
|
177
|
+
def send_event(name, source: SQSMessage::SQS_EVENT_SOURCE, time: Time.now, **attrs)
|
178
|
+
attrs['eventName'] = name
|
179
|
+
attrs['eventSource'] = source
|
180
|
+
attrs['eventTime'] = time.iso8601
|
181
|
+
send_object(attrs)
|
182
|
+
end
|
183
|
+
|
173
184
|
def delete_message(msg)
|
174
185
|
client.delete_message(
|
175
186
|
queue_url: @url,
|
@@ -439,4 +450,18 @@ module Bricolage
|
|
439
450
|
|
440
451
|
end # class UnknownSQSMessage
|
441
452
|
|
453
|
+
|
454
|
+
# library private
|
455
|
+
class ObjectMessage
|
456
|
+
|
457
|
+
def initialize(body, delay_seconds: 0)
|
458
|
+
@body = body
|
459
|
+
@delay_seconds = delay_seconds
|
460
|
+
end
|
461
|
+
|
462
|
+
attr_reader :body
|
463
|
+
attr_reader :delay_seconds
|
464
|
+
|
465
|
+
end
|
466
|
+
|
442
467
|
end # module Bricolage
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bricolage-streamingload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minero Aoki
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-09-
|
12
|
+
date: 2016-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bricolage
|
@@ -17,42 +17,42 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 5.
|
20
|
+
version: 5.17.1
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 5.
|
27
|
+
version: 5.17.1
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: pg
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.18.
|
34
|
+
version: 0.18.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0.18.
|
41
|
+
version: 0.18.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: aws-sdk
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 2.
|
48
|
+
version: 2.6.2
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 2.
|
55
|
+
version: 2.6.2
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rake
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,12 +101,20 @@ email:
|
|
101
101
|
executables:
|
102
102
|
- bricolage-streaming-dispatcher
|
103
103
|
- bricolage-streaming-loader
|
104
|
+
- send-checkpoint-event
|
105
|
+
- send-data-event
|
106
|
+
- send-load-task
|
107
|
+
- send-shutdown-event
|
104
108
|
extensions: []
|
105
109
|
extra_rdoc_files: []
|
106
110
|
files:
|
107
111
|
- README.md
|
108
112
|
- bin/bricolage-streaming-dispatcher
|
109
113
|
- bin/bricolage-streaming-loader
|
114
|
+
- bin/send-checkpoint-event
|
115
|
+
- bin/send-data-event
|
116
|
+
- bin/send-load-task
|
117
|
+
- bin/send-shutdown-event
|
110
118
|
- lib/bricolage/nulllogger.rb
|
111
119
|
- lib/bricolage/snsdatasource.rb
|
112
120
|
- lib/bricolage/sqsdatasource.rb
|