bricolage 5.24.3 → 5.24.4

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: d7ca2ab62113b959d79f3102daa165cd7e843253
4
- data.tar.gz: 9bac20ab47ac97242583a9075b5799a63ef07f52
3
+ metadata.gz: 832c3083b42f0c549ed2dbc8441716b16b093d3e
4
+ data.tar.gz: 50fd92b977334362676bd587bbd02fed46327213
5
5
  SHA512:
6
- metadata.gz: 4250720a52ba659add07a834c4a91f5d4d87165cf51bb4caeff78a93902173c2b2c55e244d42ad5f5fadeb90404743fbc63bd9b969f30241aa45ee19e8547fc7
7
- data.tar.gz: 6b52d33d3dd7f0484248f6dbf3b0edc20f8509c81c63efcfae600eabe85b5efc95d29d7f97c57d5d2d0814d6b7f5a65bdb6d61d0d9fe161a0c20ab5e3cadda7c
6
+ metadata.gz: 1f0ed17c1a0e745cc5b54beb0bc434a5922a2f2767607002d40ba2f3599c31258b8dfb54e5b45a2cbd530cd49302d1a0b35c22d19815e77bb96946a79af7514e
7
+ data.tar.gz: e3ba6c8d1020d46e96e1e110e759e4022f3d63243f9d621e88278c0067337c574dab9062df3124c667a915ce4496cb6c260d8b741b33c46e199d48c636cd33d7
@@ -230,23 +230,16 @@ module Bricolage
230
230
  end
231
231
 
232
232
  def s3export
233
- cmd = build_cmd(environment_variables, command_parameters)
234
- ds.logger.info "[CMD] #{format_cmd(cmd)}"
235
- Open3.popen2e(*cmd) do |input, output, thread|
236
- input.close
237
- output.each do |line|
238
- puts line
239
- end
240
- unless thread.value.success?
241
- raise JobFailure, "mys3dump failed (status #{thread.value.to_i})"
242
- end
233
+ cmd = build_cmd(command_parameters)
234
+ ds.logger.info "[CMD] #{cmd}"
235
+ out, st = Open3.capture2e(environment_variables, cmd)
236
+ ds.logger.info "[CMDOUT] #{out}"
237
+ unless st.success?
238
+ msg = extract_exception_message(out)
239
+ raise JobFailure, "mys3dump failed (status: #{st.to_i}): #{msg}"
243
240
  end
244
241
  end
245
242
 
246
- def format_cmd(cmd)
247
- cmd[1..-1].join(' ') # do not show env
248
- end
249
-
250
243
  def environment_variables
251
244
  {
252
245
  'AWS_ACCESS_KEY_ID' => @s3ds.access_key,
@@ -306,8 +299,16 @@ module Bricolage
306
299
  Pathname(__dir__).parent.parent + "libexec/mys3dump.jar"
307
300
  end
308
301
 
309
- def build_cmd(environ, options)
310
- [environ, 'java'] + options.flat_map {|k, v| v ? ["-#{k}", v.to_s] : ["-#{k}"] }
302
+ def build_cmd(options)
303
+ (['java'] + options.flat_map {|k, v| v ? ["-#{k}", v.to_s] : ["-#{k}"] }.map {|o| %Q("#{o}") }).join(" ")
304
+ end
305
+
306
+ def extract_exception_message(out)
307
+ out.lines do |line|
308
+ if /^.*Exception: (?<msg>.*)$/ =~ line
309
+ return msg
310
+ end
311
+ end
311
312
  end
312
313
  end
313
314
 
@@ -245,7 +245,7 @@ module Bricolage
245
245
  end
246
246
 
247
247
  def parse(source)
248
- parse_meta(read_mata(source))
248
+ parse_meta(read_meta(source))
249
249
  end
250
250
 
251
251
  private
@@ -279,7 +279,7 @@ module Bricolage
279
279
 
280
280
  KEYS_RE = /\A--(?:#{DECLARATIONS.keys.join('|')}):/
281
281
 
282
- def read_mata(source)
282
+ def read_meta(source)
283
283
  lines = ''
284
284
  source.each_line do |line|
285
285
  case line
@@ -287,7 +287,7 @@ module Bricolage
287
287
  lines.concat line.sub(/\A--/, '')
288
288
  when /\A--([\w\-]+):/
289
289
  key = $1
290
- raise ParameterError, "unknown SQL meta data: #{source.name}: #{key}"
290
+ raise ParameterError, "unknown SQL meta data: #{source}: #{key}"
291
291
  when /\A--/
292
292
  # skip non-metadata comments
293
293
  lines.concat "\n"
@@ -1,4 +1,4 @@
1
1
  module Bricolage
2
2
  APPLICATION_NAME = 'Bricolage'
3
- VERSION = '5.24.3'
3
+ VERSION = '5.24.4'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bricolage
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.24.3
4
+ version: 5.24.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minero Aoki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-10 00:00:00.000000000 Z
11
+ date: 2017-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -208,7 +208,6 @@ files:
208
208
  - test/home/data/20141002-1355_02.txt
209
209
  - test/home/data/test.txt
210
210
  - test/home/jobnet-test.rb
211
- - test/home/subsys/20170214_1225_0_strload.data.json.gz
212
211
  - test/home/subsys/d.ct
213
212
  - test/home/subsys/insert.sql.job
214
213
  - test/home/subsys/item_pv_acc.ct
@@ -237,9 +236,6 @@ files:
237
236
  - test/home/subsys/separated.job
238
237
  - test/home/subsys/separated.sql
239
238
  - test/home/subsys/some_view-cv.sql.job
240
- - test/home/subsys/streaming_load.ct
241
- - test/home/subsys/streaming_load.job
242
- - test/home/subsys/streaming_load_wk.ct
243
239
  - test/home/subsys/unified.jobnet
244
240
  - test/home/subsys/unified.sql.job
245
241
  - test/home/subsys/users.ct
@@ -1,4 +0,0 @@
1
- create table streaming_load (
2
- col1 int
3
- , col2 varchar(32)
4
- )
@@ -1,21 +0,0 @@
1
- class: streaming_load
2
-
3
- s3-ds: s3
4
- keep-ctl: true
5
- ctl-prefix: /strload/ctl/
6
- queue-path: /strload/queue/
7
- persistent-path: /strload/year=%Y/month=%m/day=%d/
8
- file-name: "%Y%m%d_%H%M_%Q_%*.gz"
9
-
10
- redshift-ds: dwh_db
11
- dest-table: $test_schema.streaming_load
12
- work-table: $test_schema.streaming_load_wk
13
- log-table: $test_schema.streaming_load_l
14
- load-options:
15
- json: "auto"
16
- gzip: true
17
- maxerror: 0
18
- timeformat: "auto"
19
- truncatecolumns: true
20
- acceptinvchars: " "
21
- skip-work: true
@@ -1,4 +0,0 @@
1
- create table streaming_load_wk (
2
- col1 int
3
- , col2 varchar(32)
4
- )