td 0.16.1 → 0.16.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/.travis.yml +4 -3
- data/ChangeLog +10 -0
- data/README.rdoc +4 -2
- data/Rakefile +0 -4
- data/lib/td/command/account.rb +1 -1
- data/lib/td/command/export.rb +8 -1
- data/lib/td/command/job.rb +1 -2
- data/lib/td/command/table.rb +2 -1
- data/lib/td/config.rb +2 -12
- data/lib/td/version.rb +1 -1
- data/spec/td/command/export_spec.rb +17 -2
- data/spec/td/config_spec.rb +51 -4
- data/td.gemspec +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07bd70e5cee714b760756d94558404b9ecc4598c9c9c5a16794f4e15cb61a8a5
|
4
|
+
data.tar.gz: ddc1af1f1076065a2e71e7f52b0efb7494cd1c85d3262bcafee94224c039821c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93357bcda065b255b1e8d4f2e1318c05f5a00981a85fae7bfaf6c2c80cc9e81e55def7153323a7e2376ea5faff67273ff4e3bf24bdd2e71d7d5d0852989ecf2b
|
7
|
+
data.tar.gz: b8ad6a5ad0c55fe8b06edb55468b58c1f0ef2d5c59ee1f97f0e25b40cf4670b43f41574303dea9a065388f7ad8f2c258de0a605137ce2b84ca2989496a1ad7f7
|
data/.travis.yml
CHANGED
data/ChangeLog
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
== 2018-11-21 version 0.16.3
|
2
|
+
|
3
|
+
* Support running status of job for td export:result command #207
|
4
|
+
* Support eu01 region #211
|
5
|
+
* Use Ruby 2.4.5 #215
|
6
|
+
|
7
|
+
== 2018-04-24 version 0.16.2
|
8
|
+
|
9
|
+
* repackage Windows td-toolbelt (no code change)
|
10
|
+
|
1
11
|
== 2018-04-17 version 0.16.1
|
2
12
|
|
3
13
|
* Use x64 binary #206
|
data/README.rdoc
CHANGED
@@ -8,7 +8,7 @@ to interact with the REST API in managing databases and jobs on the Treasure Dat
|
|
8
8
|
|
9
9
|
For more info about Treasure Data, see <http://treasure-data.com/>.
|
10
10
|
|
11
|
-
For full documentation see <
|
11
|
+
For full documentation see <https://support.treasuredata.com/hc/en-us>.
|
12
12
|
|
13
13
|
= Getting Started
|
14
14
|
|
@@ -43,6 +43,8 @@ And then run following commands:
|
|
43
43
|
$ /usr/local/td/ruby/bin/bundle install
|
44
44
|
$ /usr/local/td/ruby/bin/rake pkg:build
|
45
45
|
|
46
|
+
It uses https://github.com/treasure-data/ruby-osx-packager
|
47
|
+
|
46
48
|
== Windows
|
47
49
|
|
48
50
|
Install following binary packages:
|
@@ -69,7 +71,7 @@ The Bulk Import CLI is downloaded automatically at the first call to any of the
|
|
69
71
|
need internet connectivity in order to fetch the Bulk Import CLI JAR file from the
|
70
72
|
{Central Maven repository}[http://central.maven.org/maven2/com/treasuredata/td-import/]
|
71
73
|
and take advantage of these advanced features. If you need to setup a proxy, please consult this
|
72
|
-
{documentation}[
|
74
|
+
{documentation}[https://support.treasuredata.com/hc/en-us/articles/360001502527-Legacy-Bulk-Import-Tips-and-Tricks#How%20to%20use%20a%20proxy%20server] page.
|
73
75
|
|
74
76
|
The log levels and properties of the Bulk Import CLI can be configured in a +logging.properties+ file. A default
|
75
77
|
configuration is provided in a file within the gem or Toolbelt folder root, in the +java/+ folder. If you wish to
|
data/Rakefile
CHANGED
data/lib/td/command/account.rb
CHANGED
@@ -41,7 +41,7 @@ module Command
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
$stdout.puts "Enter your Treasure Data credentials. For Google SSO user, please see https://
|
44
|
+
$stdout.puts "Enter your Treasure Data credentials. For Google SSO user, please see https://support.treasuredata.com/hc/en-us/articles/360000720048-Treasure-Data-Toolbelt-Command-line-Interface#Google%20SSO%20Users"
|
45
45
|
unless user_name
|
46
46
|
begin
|
47
47
|
$stdout.print "Email: "
|
data/lib/td/command/export.rb
CHANGED
@@ -32,8 +32,15 @@ module Command
|
|
32
32
|
retry_limit: retry_limit,
|
33
33
|
priority: priority,
|
34
34
|
}
|
35
|
-
|
35
|
+
if wait
|
36
|
+
job = client.job(target_job_id)
|
37
|
+
if !job.finished?
|
38
|
+
$stderr.puts "target job #{target_job_id} is still running..."
|
39
|
+
wait_job(job)
|
40
|
+
end
|
41
|
+
end
|
36
42
|
|
43
|
+
job = client.result_export(target_job_id, opts)
|
37
44
|
$stderr.puts "result export job #{job.job_id} is queued."
|
38
45
|
$stderr.puts "Use '#{$prog} " + Config.cl_options_string + "job:show #{job.job_id}' to show the status."
|
39
46
|
|
data/lib/td/command/job.rb
CHANGED
@@ -196,6 +196,7 @@ private
|
|
196
196
|
end
|
197
197
|
|
198
198
|
if wait && !job.finished?
|
199
|
+
$stderr.puts "the job #{job.job_id} is still running..."
|
199
200
|
wait_job(job)
|
200
201
|
if [:hive, :pig, :impala, :presto].include?(job.type) && !exclude
|
201
202
|
show_result_with_retry(job, output, limit, format, render_opts)
|
@@ -227,8 +228,6 @@ private
|
|
227
228
|
end
|
228
229
|
|
229
230
|
def wait_job(job, first_call = false, wait = nil)
|
230
|
-
$stderr.puts "queued..."
|
231
|
-
|
232
231
|
cmdout_lines = 0
|
233
232
|
stderr_lines = 0
|
234
233
|
max_error_counts = JOB_WAIT_MAX_RETRY_COUNT_ON_NETWORK_ERROR
|
data/lib/td/command/table.rb
CHANGED
@@ -40,7 +40,7 @@ module Command
|
|
40
40
|
if HIVE_RESERVED_KEYWORDS.include?(table_name.upcase)
|
41
41
|
$stderr.puts "* WARNING *"
|
42
42
|
$stderr.puts " '#{table_name}' is a reserved keyword in Hive. We recommend renaming the table."
|
43
|
-
$stderr.puts " For a list of all reserved keywords, see our FAQ:
|
43
|
+
$stderr.puts " For a list of all reserved keywords, see our FAQ: https://support.treasuredata.com/hc/en-us/articles/360009531173/"
|
44
44
|
end
|
45
45
|
|
46
46
|
client = get_client
|
@@ -348,6 +348,7 @@ module Command
|
|
348
348
|
$stderr.puts "Use '#{$prog} " + Config.cl_options_string + "job:show #{job.job_id}' to show the status."
|
349
349
|
|
350
350
|
if wait
|
351
|
+
$stderr.puts "queued..."
|
351
352
|
wait_job(job)
|
352
353
|
$stdout.puts "Status : #{job.status}"
|
353
354
|
end
|
data/lib/td/config.rb
CHANGED
@@ -166,18 +166,8 @@ class Config
|
|
166
166
|
|
167
167
|
def self.workflow_endpoint
|
168
168
|
case self.endpoint_domain
|
169
|
-
when
|
170
|
-
|
171
|
-
when /\Aapi-([^.]*).connect.treasuredata.com\z/
|
172
|
-
"https://api-workflow-#{$1}.connect.treasuredata.com"
|
173
|
-
when 'api-staging.treasuredata.com'
|
174
|
-
'https://api-staging-workflow.treasuredata.com'
|
175
|
-
when 'api.treasuredata.co.jp'
|
176
|
-
'https://api-workflow.treasuredata.co.jp'
|
177
|
-
when /\Aapi-([^.]*).connect.treasuredata.co.jp\z/
|
178
|
-
"https://api-workflow-#{$1}.connect.treasuredata.co.jp"
|
179
|
-
when 'api-staging.treasuredata.co.jp'
|
180
|
-
'https://api-staging-workflow.treasuredata.co.jp'
|
169
|
+
when /\Aapi(-(?:staging|development))?(-[a-z]+)?.(connect\.)?(eu01\.)?treasuredata.(com|co\.jp)\z/
|
170
|
+
"https://api#{$1}-workflow#{$2}.#{$3}#{$4}treasuredata.#{$5}"
|
181
171
|
else
|
182
172
|
raise ConfigError, "Workflow is not supported for '#{self.endpoint}'"
|
183
173
|
end
|
data/lib/td/version.rb
CHANGED
@@ -146,12 +146,15 @@ module TreasureData::Command
|
|
146
146
|
let(:option_with_wrong_priority) {
|
147
147
|
List::CommandParser.new("export:result", ["target_job_id", "result_url"], [], nil, ['-P', '3'] + option_list, true)
|
148
148
|
}
|
149
|
+
let(:option_with_wait) {
|
150
|
+
List::CommandParser.new("export:result", ["target_job_id", "result_url"], [], nil, ['-w'] + option_list, true)
|
151
|
+
}
|
149
152
|
let(:option_list) { [110, 'mysql://user:pass@host.com/database/table'] }
|
150
153
|
let(:job_id) { 111 }
|
154
|
+
let(:client) { double(:client) }
|
155
|
+
let(:job) { double(:job, job_id: job_id) }
|
151
156
|
|
152
157
|
before do
|
153
|
-
client = double(:client)
|
154
|
-
job = double(:job, job_id: job_id)
|
155
158
|
allow(client).to receive(:result_export).and_return(job)
|
156
159
|
|
157
160
|
allow(command).to receive(:get_client).and_return(client)
|
@@ -180,6 +183,18 @@ module TreasureData::Command
|
|
180
183
|
command.export_result(option_with_wrong_priority)
|
181
184
|
}.to raise_exception
|
182
185
|
end
|
186
|
+
|
187
|
+
it 'detects wait option' do
|
188
|
+
target_job = double('target_job')
|
189
|
+
expect(client).to receive(:job).and_return(target_job)
|
190
|
+
count_target_job_finished_p = 0
|
191
|
+
expect(target_job).to receive(:finished?).and_return(false)
|
192
|
+
allow(target_job).to receive(:wait)
|
193
|
+
allow(target_job).to receive(:status)
|
194
|
+
allow(job).to receive(:wait)
|
195
|
+
allow(job).to receive(:status)
|
196
|
+
command.export_result(option_with_wait)
|
197
|
+
end
|
183
198
|
end
|
184
199
|
end
|
185
200
|
end
|
data/spec/td/config_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'tempfile'
|
2
3
|
require 'td/config'
|
3
4
|
|
4
5
|
describe TreasureData::Config do
|
@@ -19,18 +20,24 @@ describe TreasureData::Config do
|
|
19
20
|
it { is_expected.to eq 'https://api-workflow.treasuredata.com' }
|
20
21
|
end
|
21
22
|
end
|
22
|
-
context 'api-hoge.connect.treasuredata.com' do
|
23
|
-
let(:api_endpoint){ 'api-hoge.connect.treasuredata.com' }
|
24
|
-
it { is_expected.to eq 'https://api-workflow-hoge.connect.treasuredata.com' }
|
25
|
-
end
|
26
23
|
context 'api.treasuredata.co.jp' do
|
27
24
|
let(:api_endpoint){ 'api.treasuredata.co.jp' }
|
28
25
|
it { is_expected.to eq 'https://api-workflow.treasuredata.co.jp' }
|
29
26
|
end
|
27
|
+
context 'api.eu01.treasuredata.com' do
|
28
|
+
let(:api_endpoint){ 'api.eu01.treasuredata.com' }
|
29
|
+
it { is_expected.to eq 'https://api-workflow.eu01.treasuredata.com' }
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'api-hoge.connect.treasuredata.com' do
|
33
|
+
let(:api_endpoint){ 'api-hoge.connect.treasuredata.com' }
|
34
|
+
it { is_expected.to eq 'https://api-workflow-hoge.connect.treasuredata.com' }
|
35
|
+
end
|
30
36
|
context 'api-hoge.connect.treasuredata.co.jp' do
|
31
37
|
let(:api_endpoint){ 'api-hoge.connect.treasuredata.co.jp' }
|
32
38
|
it { is_expected.to eq 'https://api-workflow-hoge.connect.treasuredata.co.jp' }
|
33
39
|
end
|
40
|
+
|
34
41
|
context 'api-staging.treasuredata.com' do
|
35
42
|
let(:api_endpoint){ 'api-staging.treasuredata.com' }
|
36
43
|
it { is_expected.to eq 'https://api-staging-workflow.treasuredata.com' }
|
@@ -39,6 +46,24 @@ describe TreasureData::Config do
|
|
39
46
|
let(:api_endpoint){ 'api-staging.treasuredata.co.jp' }
|
40
47
|
it { is_expected.to eq 'https://api-staging-workflow.treasuredata.co.jp' }
|
41
48
|
end
|
49
|
+
context 'api-staging.eu01.treasuredata.com' do
|
50
|
+
let(:api_endpoint){ 'api-staging.eu01.treasuredata.com' }
|
51
|
+
it { is_expected.to eq 'https://api-staging-workflow.eu01.treasuredata.com' }
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'api-development.treasuredata.com' do
|
55
|
+
let(:api_endpoint){ 'api-development.treasuredata.com' }
|
56
|
+
it { is_expected.to eq 'https://api-development-workflow.treasuredata.com' }
|
57
|
+
end
|
58
|
+
context 'api-development.treasuredata.co.jp' do
|
59
|
+
let(:api_endpoint){ 'api-development.treasuredata.co.jp' }
|
60
|
+
it { is_expected.to eq 'https://api-development-workflow.treasuredata.co.jp' }
|
61
|
+
end
|
62
|
+
context 'api-development.eu01.treasuredata.com' do
|
63
|
+
let(:api_endpoint){ 'api-development.eu01.treasuredata.com' }
|
64
|
+
it { is_expected.to eq 'https://api-development-workflow.eu01.treasuredata.com' }
|
65
|
+
end
|
66
|
+
|
42
67
|
context 'ybi.jp-east.idcfcloud.com' do
|
43
68
|
let(:api_endpoint){ 'ybi.jp-east.idcfcloud.com' }
|
44
69
|
it 'raise error' do
|
@@ -46,4 +71,26 @@ describe TreasureData::Config do
|
|
46
71
|
end
|
47
72
|
end
|
48
73
|
end
|
74
|
+
|
75
|
+
describe '#read' do
|
76
|
+
it 'sets @conf' do
|
77
|
+
Tempfile.create('td.conf') do |f|
|
78
|
+
f << <<-EOF
|
79
|
+
# This is comment
|
80
|
+
[section1]
|
81
|
+
# This is comment
|
82
|
+
key=val
|
83
|
+
foo=bar
|
84
|
+
EOF
|
85
|
+
|
86
|
+
f.close
|
87
|
+
|
88
|
+
config = TreasureData::Config.new
|
89
|
+
config.read(f.path)
|
90
|
+
|
91
|
+
expect(config["section1.key"]).to eq "val"
|
92
|
+
expect(config["section1.foo"]).to eq "bar"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
49
96
|
end
|
data/td.gemspec
CHANGED
@@ -10,7 +10,6 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.version = TreasureData::TOOLBELT_VERSION
|
11
11
|
gem.authors = ["Treasure Data, Inc."]
|
12
12
|
gem.email = "support@treasure-data.com"
|
13
|
-
gem.has_rdoc = false
|
14
13
|
gem.files = `git ls-files`.split("\n").select { |f| !f.start_with?('dist') }
|
15
14
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
15
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
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.16.
|
4
|
+
version: 0.16.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: 2018-
|
11
|
+
date: 2018-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|