td 0.16.1 → 0.16.3

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
  SHA256:
3
- metadata.gz: faf59038a7741d3ab97da16cc2cb5d017a15e6a98564eac31c9cf6505710aba6
4
- data.tar.gz: 87783cf3e0c522354472a60e154d0c9a3695f41d0ecf3e5b0540e35f8ae756b2
3
+ metadata.gz: 07bd70e5cee714b760756d94558404b9ecc4598c9c9c5a16794f4e15cb61a8a5
4
+ data.tar.gz: ddc1af1f1076065a2e71e7f52b0efb7494cd1c85d3262bcafee94224c039821c
5
5
  SHA512:
6
- metadata.gz: 7ca06116ebddd6217595865455533d93da3d98438ef4a4fb2dda6a52cae85575405676634095dff8e221ac30f72a008ccb5b607350789bfa2a1d5ce84f0d4b99
7
- data.tar.gz: 5f90407907760f8e108d5eda9a2f06461510e474a9d33a59a61351724c9188d57bc268e56bd56a08f29596a0be36be0cd0098503375fa292a486823717f96b35
6
+ metadata.gz: 93357bcda065b255b1e8d4f2e1318c05f5a00981a85fae7bfaf6c2c80cc9e81e55def7153323a7e2376ea5faff67273ff4e3bf24bdd2e71d7d5d0852989ecf2b
7
+ data.tar.gz: b8ad6a5ad0c55fe8b06edb55468b58c1f0ef2d5c59ee1f97f0e25b40cf4670b43f41574303dea9a065388f7ad8f2c258de0a605137ce2b84ca2989496a1ad7f7
data/.travis.yml CHANGED
@@ -5,9 +5,10 @@ jdk:
5
5
 
6
6
  rvm:
7
7
  - 2.1.10
8
- - 2.2.9
9
- - 2.3.6
10
- - 2.4.3
8
+ - 2.2.10
9
+ - 2.3.8
10
+ - 2.4.5
11
+ - 2.5.3
11
12
  - ruby-head
12
13
 
13
14
  gemfile:
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 <http://docs.treasure-data.com/>.
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}[http://docs.treasuredata.com/articles/faq#how-can-i-use-the-td-command-through-a-proxy] page.
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
@@ -14,10 +14,6 @@ def version
14
14
  TreasureData::TOOLBELT_VERSION
15
15
  end
16
16
 
17
- task "jar" do
18
- system('./build/update-td-import-java.sh')
19
- end
20
-
21
17
  def project_root_path(path)
22
18
  "#{PROJECT_ROOT}/#{path}"
23
19
  end
@@ -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://docs.treasuredata.com/articles/command-line#google-sso-users"
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: "
@@ -32,8 +32,15 @@ module Command
32
32
  retry_limit: retry_limit,
33
33
  priority: priority,
34
34
  }
35
- job = client.result_export(target_job_id, opts)
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
 
@@ -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
@@ -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: http://docs.treasure-data.com/articles/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 'api.treasuredata.com'
170
- 'https://api-workflow.treasuredata.com'
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
@@ -1,3 +1,3 @@
1
1
  module TreasureData
2
- TOOLBELT_VERSION = '0.16.1'
2
+ TOOLBELT_VERSION = '0.16.3'
3
3
  end
@@ -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
@@ -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.1
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-04-17 00:00:00.000000000 Z
11
+ date: 2018-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack