td 0.15.9 → 0.16.0

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
- SHA1:
3
- metadata.gz: f678ed9a6f000112a64bd9a86cd05d7d4bb0382e
4
- data.tar.gz: ba6f79ddbf05bc67dccec2201c536eb4f508ff35
2
+ SHA256:
3
+ metadata.gz: 236d538e66d7f11f77ff46593d7b3b78355585120a9f5f542aa0bb536e645da6
4
+ data.tar.gz: 63943d8db85010b46c2618e87c18f447da27b9d94c079372483d412c55fd220f
5
5
  SHA512:
6
- metadata.gz: 6ee3352ff5b7d72a3573365e8b23d2331a9f50cf60499be207ec393098f30368dd2f35dd4717cf248fad959fc23debde14f0018657733f671b4b57c2d335a65f
7
- data.tar.gz: 2ca8f66b7e4311be225f8fe8456a935a7db785331135878986e5de7e9b493198690b9cd01cf4d774e3a2e77cbe8fc4dd1d60a1b60237fd309bf259b49cc72eee
6
+ metadata.gz: ca2fdf5e60e84bd33b86a4ab6004de7c499a94a6abace2ef0a8d348fa2879223bc72533f1a2f91571bebcf8dd064f497d9f2844e3837c35586a7f265ae167ac9
7
+ data.tar.gz: d748e199e3efd292fe97d887161149f41caa23f2ffeb49c2e025962c30d20d5b40538e7eadb75a05f9fca9eee0bd24958d4a331905c7d0dfa27c51bec17342f0
@@ -7,17 +7,31 @@ module Command
7
7
 
8
8
  def export_result(op)
9
9
  wait = false
10
+ priority = nil
11
+ retry_limit = nil
10
12
 
11
13
  op.on('-w', '--wait', 'wait until the job is completed', TrueClass) {|b|
12
14
  wait = b
13
15
  }
16
+ op.on('-P', '--priority PRIORITY', 'set priority') {|s|
17
+ priority = job_priority_id_of(s)
18
+ unless priority
19
+ raise "unknown priority #{s.inspect} should be -2 (very-low), -1 (low), 0 (normal), 1 (high) or 2 (very-high)"
20
+ end
21
+ }
22
+ op.on('-R', '--retry COUNT', 'automatic retrying count', Integer) {|i|
23
+ retry_limit = i
24
+ }
14
25
 
15
26
  target_job_id, result = op.cmd_parse
16
27
 
17
28
  client = get_ssl_client
18
29
 
19
- opts = {}
20
- opts['result'] = result
30
+ opts = {
31
+ result: result,
32
+ retry_limit: retry_limit,
33
+ priority: priority,
34
+ }
21
35
  job = client.result_export(target_job_id, opts)
22
36
 
23
37
  $stderr.puts "result export job #{job.job_id} is queued."
@@ -142,11 +142,11 @@ module ModuleDefinition
142
142
  end
143
143
 
144
144
  def version_endpoint
145
- "#{endpoint_root}/latest_version.#{package_category}"
145
+ "#{endpoint_root}/latest_version_0_16.#{package_category}"
146
146
  end
147
147
 
148
148
  def update_package_endpoint
149
- "#{endpoint_root}/td-update-#{package_category}.zip"
149
+ "#{endpoint_root}/td-update-#{package_category}-0-16.zip"
150
150
  end
151
151
 
152
152
  def update(autoupdate = false)
@@ -181,7 +181,7 @@ module ModuleDefinition
181
181
  zip.extract(entry, target) { true }
182
182
  end
183
183
  end
184
- $stdout.print "done\n"
184
+ $stdout.print " done\n"
185
185
 
186
186
  FileUtils.rm "#{download_dir}/td-update.zip"
187
187
 
@@ -221,30 +221,6 @@ module ModuleDefinition
221
221
  end
222
222
  load('td/updater.rb') # reload updated updater
223
223
  end
224
-
225
- # check every hour if the toolbelt can be updated.
226
- # => If so, update in the background
227
- if File.exists?(last_toolbelt_autoupdate_timestamp)
228
- return if (Time.now.to_i - File.mtime(last_toolbelt_autoupdate_timestamp).to_i) < 60 * 60 * 1 # every 1 hours
229
- end
230
- log_path = File.join(home_directory, '.td', 'autoupdate.log')
231
- FileUtils.mkdir_p File.dirname(log_path)
232
- td_binary = File.expand_path($0)
233
- pid = if defined?(RUBY_VERSION) and RUBY_VERSION =~ /^1\.8\.\d+/
234
- fork do
235
- exec("#{Shellwords.escape(td_binary)} update &> #{Shellwords.escape(log_path)} 2>&1")
236
- end
237
- else
238
- log_file = File.open(log_path, "w")
239
- spawn(td_binary, 'update', :err => log_file, :out => log_file)
240
- end
241
- Process.detach(pid)
242
- FileUtils.mkdir_p File.dirname(last_toolbelt_autoupdate_timestamp)
243
- FileUtils.touch last_toolbelt_autoupdate_timestamp
244
- end
245
-
246
- def last_toolbelt_autoupdate_timestamp
247
- File.join(home_directory, ".td", "autoupdate.last")
248
224
  end
249
225
 
250
226
  #
@@ -1,3 +1,3 @@
1
1
  module TreasureData
2
- TOOLBELT_VERSION = '0.15.9'
2
+ TOOLBELT_VERSION = '0.16.0'
3
3
  end
@@ -137,6 +137,15 @@ module TreasureData::Command
137
137
  let(:option) {
138
138
  List::CommandParser.new("export:result", ["target_job_id", "result_url"], [], nil, option_list, true)
139
139
  }
140
+ let(:option_with_retry) {
141
+ List::CommandParser.new("export:result", ["target_job_id", "result_url"], [], nil, ['-R', '3'] + option_list, true)
142
+ }
143
+ let(:option_with_priority) {
144
+ List::CommandParser.new("export:result", ["target_job_id", "result_url"], [], nil, ['-P', '-2'] + option_list, true)
145
+ }
146
+ let(:option_with_wrong_priority) {
147
+ List::CommandParser.new("export:result", ["target_job_id", "result_url"], [], nil, ['-P', '3'] + option_list, true)
148
+ }
140
149
  let(:option_list) { [110, 'mysql://user:pass@host.com/database/table'] }
141
150
  let(:job_id) { 111 }
142
151
 
@@ -153,6 +162,24 @@ module TreasureData::Command
153
162
  command.export_result(option)
154
163
  }.not_to raise_exception
155
164
  end
165
+
166
+ it 'works with retry option' do
167
+ expect {
168
+ command.export_result(option_with_retry)
169
+ }.not_to raise_exception
170
+ end
171
+
172
+ it 'works with priority option' do
173
+ expect {
174
+ command.export_result(option_with_priority)
175
+ }.not_to raise_exception
176
+ end
177
+
178
+ it 'detects wrong priority option' do
179
+ expect {
180
+ command.export_result(option_with_wrong_priority)
181
+ }.to raise_exception
182
+ end
156
183
  end
157
184
  end
158
185
  end
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.9
4
+ version: 0.16.0
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-04 00:00:00.000000000 Z
11
+ date: 2018-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -309,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
309
309
  version: '0'
310
310
  requirements: []
311
311
  rubyforge_project:
312
- rubygems_version: 2.6.13
312
+ rubygems_version: 2.7.6
313
313
  signing_key:
314
314
  specification_version: 4
315
315
  summary: CLI to manage data on Treasure Data, the Hadoop-based cloud data warehousing