td 0.15.2 → 0.15.3
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/ChangeLog +5 -0
- data/contrib/completion/_td +2 -1
- data/lib/td/command/bulk_import.rb +1 -0
- data/lib/td/command/export.rb +9 -4
- data/lib/td/command/list.rb +3 -2
- data/lib/td/command/query.rb +1 -0
- data/lib/td/command/table.rb +4 -7
- data/lib/td/command/workflow.rb +23 -6
- data/lib/td/version.rb +1 -1
- data/td.gemspec +2 -2
- metadata +15 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0664e06a537f0c5e0a8c191df507b03462a803dd
|
4
|
+
data.tar.gz: e03b262494754689483a2e132401efdc1f436b6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65c89dc8dd648fb8ad188be1da9dd2a26e1b07b93ad1dfbc7119870e7d648f13290bb1828e0f087932afcd8103fe425ac5f2eff2fcbe7832a2ec083d56b4f3ba
|
7
|
+
data.tar.gz: 819bf1005d21dbb40e671f4e93dabfbff79ce0c948982e5734dfb75d640466197300a4857564455f802de3f6fe5f5df34d56d069b8c4704dcf7f47a06c79fea9
|
data/ChangeLog
CHANGED
data/contrib/completion/_td
CHANGED
@@ -16,7 +16,7 @@ subcommands=(
|
|
16
16
|
|
17
17
|
"bulk_import\:list":"List bulk import sessions"
|
18
18
|
"bulk_import\:show":"Show list of uploaded parts"
|
19
|
-
"bulk_import\:create":"Create a new bulk import session to the
|
19
|
+
"bulk_import\:create":"Create a new bulk import session to the table"
|
20
20
|
"bulk_import\:prepare_parts":"Convert files into part file format"
|
21
21
|
#"bulk_import\:prepare_parts2":"Convert files into part file format"
|
22
22
|
"bulk_import\:upload_part":"Upload or re-upload a file into a bulk import session"
|
@@ -84,6 +84,7 @@ subcommands=(
|
|
84
84
|
"wf":"Run a workflow command"
|
85
85
|
"workflow":"Run a workflow command"
|
86
86
|
"workflow:reset":"Reset the workflow module"
|
87
|
+
"workflow:update":"Update the workflow module"
|
87
88
|
|
88
89
|
# TODO: Add ACL related commands
|
89
90
|
)
|
data/lib/td/command/export.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
require 'td/command/job'
|
1
2
|
|
2
3
|
module TreasureData
|
3
4
|
module Command
|
4
|
-
SUPPORTED_FORMATS = %W[json.gz line-json.gz tsv.gz]
|
5
|
+
SUPPORTED_FORMATS = %W[json.gz line-json.gz tsv.gz jsonl.gz]
|
5
6
|
SUPPORTED_ENCRYPT_METHOD = %W[s3]
|
6
7
|
|
7
8
|
def export_result(op)
|
@@ -22,7 +23,7 @@ module Command
|
|
22
23
|
$stderr.puts "result export job #{job.job_id} is queued."
|
23
24
|
$stderr.puts "Use '#{$prog} " + Config.cl_options_string + "job:show #{job.job_id}' to show the status."
|
24
25
|
|
25
|
-
if wait
|
26
|
+
if wait
|
26
27
|
wait_job(job)
|
27
28
|
$stdout.puts "status : #{job.status}"
|
28
29
|
end
|
@@ -66,7 +67,11 @@ module Command
|
|
66
67
|
op.on('-s', '--aws-secret-key SECRET_KEY', 'AWS secret access key to export data (required)') {|s|
|
67
68
|
aws_secret_access_key = s
|
68
69
|
}
|
69
|
-
op.on('-F', '--file-format FILE_FORMAT',
|
70
|
+
op.on('-F', '--file-format FILE_FORMAT',
|
71
|
+
'file format for exported data.',
|
72
|
+
'Available formats are tsv.gz (tab-separated values per line) and jsonl.gz (JSON record per line).',
|
73
|
+
'The json.gz and line-json.gz formats are default and still available but only for backward compatibility purpose;',
|
74
|
+
' use is discouraged because they have far lower performance.') { |s|
|
70
75
|
raise ArgumentError, "#{s} is not a supported file format" unless SUPPORTED_FORMATS.include?(s)
|
71
76
|
file_format = s
|
72
77
|
}
|
@@ -121,7 +126,7 @@ module Command
|
|
121
126
|
$stderr.puts "Export job #{job.job_id} is queued."
|
122
127
|
$stderr.puts "Use '#{$prog} " + Config.cl_options_string + "job:show #{job.job_id}' to show the status."
|
123
128
|
|
124
|
-
if wait
|
129
|
+
if wait
|
125
130
|
wait_job(job)
|
126
131
|
$stdout.puts "Status : #{job.status}"
|
127
132
|
end
|
data/lib/td/command/list.rb
CHANGED
@@ -246,7 +246,7 @@ module List
|
|
246
246
|
|
247
247
|
add_list 'bulk_import:list', %w[], 'List bulk import sessions', ['bulk_import:list']
|
248
248
|
add_list 'bulk_import:show', %w[name], 'Show list of uploaded parts', ['bulk_import:show']
|
249
|
-
add_list 'bulk_import:create', %w[name db table], 'Create a new bulk import session to the
|
249
|
+
add_list 'bulk_import:create', %w[name db table], 'Create a new bulk import session to the table', ['bulk_import:create logs_201201 example_db event_logs']
|
250
250
|
add_list 'bulk_import:prepare_parts', %w[files_], 'Convert files into part file format', ['bulk_import:prepare_parts logs/*.csv --format csv --columns time,uid,price,count --time-column "time" -o parts/']
|
251
251
|
add_list 'bulk_import:upload_part', %w[name id path.msgpack.gz], 'Upload or re-upload a file into a bulk import session', ['bulk_import:upload_part logs_201201 01h data-201201-01.msgpack.gz']
|
252
252
|
add_list 'bulk_import:upload_parts', %w[name files_], 'Upload or re-upload files into a bulk import session', ['bulk_import:upload_parts parts/* --parallel 4']
|
@@ -261,7 +261,7 @@ module List
|
|
261
261
|
|
262
262
|
add_list 'import:list', %w[], 'List bulk import sessions', ['import:list']
|
263
263
|
add_list 'import:show', %w[name], 'Show list of uploaded parts', ['import:show']
|
264
|
-
add_list 'import:create', %w[name db table], 'Create a new bulk import session to the
|
264
|
+
add_list 'import:create', %w[name db table], 'Create a new bulk import session to the table', ['import:create logs_201201 example_db event_logs']
|
265
265
|
add_list 'import:jar_version', %w[], 'Show import jar version', ['import:jar_version'], false
|
266
266
|
add_list 'import:jar_update', %w[], 'Update import jar to the latest version', ['import:jar_update']
|
267
267
|
add_list 'import:prepare', %w[files_], 'Convert files into part file format', ['import:prepare logs/*.csv --format csv --columns time,uid,price,count --time-column "time" -o parts/'], false
|
@@ -362,6 +362,7 @@ module List
|
|
362
362
|
|
363
363
|
add_list 'workflow', %w[], 'Run a workflow command'
|
364
364
|
add_list 'workflow:reset', %w[], 'Reset the workflow module'
|
365
|
+
add_list 'workflow:update', %w[version?], 'Update the workflow module'
|
365
366
|
add_list 'workflow:version', %w[], 'Show workflow module version'
|
366
367
|
|
367
368
|
# aliases
|
data/lib/td/command/query.rb
CHANGED
data/lib/td/command/table.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'td/helpers'
|
2
|
+
require 'td/command/job'
|
2
3
|
|
3
4
|
module TreasureData
|
4
5
|
module Command
|
@@ -276,9 +277,7 @@ module Command
|
|
276
277
|
wait = false
|
277
278
|
pool_name = nil
|
278
279
|
|
279
|
-
op.on('-t', '--to TIME', 'end time of logs to delete in Unix time multiple of 3600 (1 hour)'
|
280
|
-
' or Ruby time string format (e.g. \'2014-07-01 14:00:00 JST\') where',
|
281
|
-
' the minutes and seconds are required to be 0.') {|s|
|
280
|
+
op.on('-t', '--to TIME', 'end time of logs to delete in Unix time >0 and multiple of 3600 (1 hour)') {|s|
|
282
281
|
if s.to_i.to_s == s
|
283
282
|
# UNIX time
|
284
283
|
to = s.to_i
|
@@ -287,9 +286,7 @@ module Command
|
|
287
286
|
to = Time.parse(s).to_i
|
288
287
|
end
|
289
288
|
}
|
290
|
-
op.on('-f', '--from TIME', 'start time of logs to delete in Unix time multiple of 3600 (1 hour)'
|
291
|
-
' or Ruby time string format (e.g. \'2014-07-01 13:00:00 JST\') where',
|
292
|
-
' the minutes and seconds are required to be 0.') {|s|
|
289
|
+
op.on('-f', '--from TIME', 'start time of logs to delete in Unix time >0 and multiple of 3600 (1 hour)') {|s|
|
293
290
|
if s.to_i.to_s == s
|
294
291
|
from = s.to_i
|
295
292
|
else
|
@@ -333,7 +330,7 @@ module Command
|
|
333
330
|
$stderr.puts "Partial delete job #{job.job_id} is queued."
|
334
331
|
$stderr.puts "Use '#{$prog} " + Config.cl_options_string + "job:show #{job.job_id}' to show the status."
|
335
332
|
|
336
|
-
if wait
|
333
|
+
if wait
|
337
334
|
wait_job(job)
|
338
335
|
$stdout.puts "Status : #{job.status}"
|
339
336
|
end
|
data/lib/td/command/workflow.rb
CHANGED
@@ -66,8 +66,18 @@ module TreasureData
|
|
66
66
|
}
|
67
67
|
end
|
68
68
|
|
69
|
+
def workflow_update(op)
|
70
|
+
version = op.cmd_parse
|
71
|
+
$stdout << "Downloading workflow module #{version}..."
|
72
|
+
download_digdag(version)
|
73
|
+
$stdout.puts ' Done.'
|
74
|
+
return 0
|
75
|
+
end
|
76
|
+
|
69
77
|
# "Factory reset"
|
70
78
|
def workflow_reset(op)
|
79
|
+
op.cmd_parse # to show help
|
80
|
+
|
71
81
|
$stdout << 'Removing workflow module...'
|
72
82
|
FileUtils.rm_rf digdag_dir
|
73
83
|
$stdout.puts ' Done.'
|
@@ -75,6 +85,8 @@ module TreasureData
|
|
75
85
|
end
|
76
86
|
|
77
87
|
def workflow_version(op)
|
88
|
+
op.cmd_parse # to show help
|
89
|
+
|
78
90
|
unless File.exists?(digdag_cli_path)
|
79
91
|
$stderr.puts('Workflow module not yet installed.')
|
80
92
|
return 1
|
@@ -118,12 +130,17 @@ module TreasureData
|
|
118
130
|
ENV.fetch('TD_WF_JAVA', '').strip
|
119
131
|
end
|
120
132
|
|
121
|
-
def digdag_base_url
|
122
|
-
'http://toolbelt.treasure-data.com/digdag'
|
133
|
+
def digdag_base_url(version=nil)
|
134
|
+
base = 'http://toolbelt.treasure-data.com/digdag'
|
135
|
+
if version.to_s == ''
|
136
|
+
base
|
137
|
+
else
|
138
|
+
"#{base}-#{version}"
|
139
|
+
end
|
123
140
|
end
|
124
141
|
|
125
142
|
private
|
126
|
-
def digdag_url
|
143
|
+
def digdag_url(version=nil)
|
127
144
|
url = ENV.fetch('TD_DIGDAG_URL', '').strip
|
128
145
|
return url unless url.empty?
|
129
146
|
user = Config.read['account.user']
|
@@ -131,7 +148,7 @@ module TreasureData
|
|
131
148
|
return digdag_base_url
|
132
149
|
end
|
133
150
|
query = URI.encode_www_form('user' => user)
|
134
|
-
"#{digdag_base_url}?#{query}"
|
151
|
+
"#{digdag_base_url(version)}?#{query}"
|
135
152
|
end
|
136
153
|
|
137
154
|
private
|
@@ -406,7 +423,7 @@ EOF
|
|
406
423
|
end
|
407
424
|
end
|
408
425
|
|
409
|
-
def download_digdag
|
426
|
+
def download_digdag(version=nil)
|
410
427
|
require 'net/http'
|
411
428
|
require 'openssl'
|
412
429
|
|
@@ -422,7 +439,7 @@ EOF
|
|
422
439
|
status = nil
|
423
440
|
download_path = File.join(download_dir, 'digdag')
|
424
441
|
File.open(download_path, 'wb') do |file|
|
425
|
-
status = Updater.stream_fetch(digdag_url, file) {
|
442
|
+
status = Updater.stream_fetch(digdag_url(version), file) {
|
426
443
|
indicator.update
|
427
444
|
}
|
428
445
|
end
|
data/lib/td/version.rb
CHANGED
data/td.gemspec
CHANGED
@@ -21,9 +21,9 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.add_dependency "yajl-ruby", "~> 1.1"
|
22
22
|
gem.add_dependency "hirb", ">= 0.4.5"
|
23
23
|
gem.add_dependency "parallel", "~> 1.8.0"
|
24
|
-
gem.add_dependency "td-client", "
|
24
|
+
gem.add_dependency "td-client", ">= 0.8.85", "< 2"
|
25
25
|
gem.add_dependency "td-logger", ">= 0.3.21", "< 2"
|
26
|
-
gem.add_dependency "rubyzip", "
|
26
|
+
gem.add_dependency "rubyzip", ">= 1.2.1"
|
27
27
|
gem.add_dependency "zip-zip", "~> 0.3"
|
28
28
|
gem.add_dependency "ruby-progressbar", "~> 1.7"
|
29
29
|
gem.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: td
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Treasure Data, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -70,16 +70,22 @@ dependencies:
|
|
70
70
|
name: td-client
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.8.85
|
76
|
+
- - "<"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '2'
|
76
79
|
type: :runtime
|
77
80
|
prerelease: false
|
78
81
|
version_requirements: !ruby/object:Gem::Requirement
|
79
82
|
requirements:
|
80
|
-
- - "
|
83
|
+
- - ">="
|
81
84
|
- !ruby/object:Gem::Version
|
82
85
|
version: 0.8.85
|
86
|
+
- - "<"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '2'
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
90
|
name: td-logger
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,16 +110,16 @@ dependencies:
|
|
104
110
|
name: rubyzip
|
105
111
|
requirement: !ruby/object:Gem::Requirement
|
106
112
|
requirements:
|
107
|
-
- - "
|
113
|
+
- - ">="
|
108
114
|
- !ruby/object:Gem::Version
|
109
|
-
version: 1.1
|
115
|
+
version: 1.2.1
|
110
116
|
type: :runtime
|
111
117
|
prerelease: false
|
112
118
|
version_requirements: !ruby/object:Gem::Requirement
|
113
119
|
requirements:
|
114
|
-
- - "
|
120
|
+
- - ">="
|
115
121
|
- !ruby/object:Gem::Version
|
116
|
-
version: 1.1
|
122
|
+
version: 1.2.1
|
117
123
|
- !ruby/object:Gem::Dependency
|
118
124
|
name: zip-zip
|
119
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -303,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
303
309
|
version: '0'
|
304
310
|
requirements: []
|
305
311
|
rubyforge_project:
|
306
|
-
rubygems_version: 2.
|
312
|
+
rubygems_version: 2.6.11
|
307
313
|
signing_key:
|
308
314
|
specification_version: 4
|
309
315
|
summary: CLI to manage data on Treasure Data, the Hadoop-based cloud data warehousing
|