td 0.10.77 → 0.10.78
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +9 -0
- data/lib/td/command/job.rb +6 -2
- data/lib/td/command/list.rb +2 -1
- data/lib/td/command/sched.rb +15 -0
- data/lib/td/command/user.rb +1 -3
- data/lib/td/version.rb +1 -1
- data/td.gemspec +2 -2
- metadata +8 -8
data/ChangeLog
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 2013-05-27 version 0.10.78
|
2
|
+
|
3
|
+
* Add -q(--query) option to sched:create command
|
4
|
+
* Add -x option to job:show, exlude result from automatically being downloaded
|
5
|
+
* Update parallel gem dependency to 0.6.1 or later
|
6
|
+
* user:add now requires email and password
|
7
|
+
* td-client v0.8.50
|
8
|
+
|
9
|
+
|
1
10
|
== 2013-05-06 version 0.10.77
|
2
11
|
|
3
12
|
* Fix 'invalid byte sequence in UTF-8' at job result writing to CSV
|
data/lib/td/command/job.rb
CHANGED
@@ -87,6 +87,7 @@ module Command
|
|
87
87
|
output = nil
|
88
88
|
format = 'tsv'
|
89
89
|
render_opts = {}
|
90
|
+
exclude = false
|
90
91
|
|
91
92
|
op.on('-v', '--verbose', 'show logs', TrueClass) {|b|
|
92
93
|
verbose = b
|
@@ -106,6 +107,9 @@ module Command
|
|
106
107
|
end
|
107
108
|
format = s
|
108
109
|
}
|
110
|
+
op.on('-x', '--exclude', 'do not automatically retrieve the job result', TrueClass) {|b|
|
111
|
+
exclude = b
|
112
|
+
}
|
109
113
|
|
110
114
|
job_id = op.cmd_parse
|
111
115
|
|
@@ -126,13 +130,13 @@ module Command
|
|
126
130
|
|
127
131
|
if wait && !job.finished?
|
128
132
|
wait_job(job)
|
129
|
-
if job.success? && [:hive, :pig].include?(job.type)
|
133
|
+
if job.success? && [:hive, :pig].include?(job.type) && !exclude
|
130
134
|
puts "Result :"
|
131
135
|
show_result(job, output, format, render_opts)
|
132
136
|
end
|
133
137
|
|
134
138
|
else
|
135
|
-
if job.success? && [:hive, :pig].include?(job.type)
|
139
|
+
if job.success? && [:hive, :pig].include?(job.type) && !exclude
|
136
140
|
puts "Result :"
|
137
141
|
show_result(job, output, format, render_opts)
|
138
142
|
end
|
data/lib/td/command/list.rb
CHANGED
@@ -259,7 +259,8 @@ module List
|
|
259
259
|
add_list 'schema:remove', %w[db table columns_], 'Remove columns from a table', 'schema:remove example_db table1 user size'
|
260
260
|
|
261
261
|
add_list 'sched:list', %w[], 'Show list of schedules', 'sched:list', 'scheds'
|
262
|
-
add_list 'sched:create', %w[name cron sql], 'Create a schedule', 'sched:create sched1 "0 * * * *" -d example_db "select count(*) from table1" -r rset1'
|
262
|
+
add_list 'sched:create', %w[name cron sql?], 'Create a schedule', 'sched:create sched1 "0 * * * *" -d example_db "select count(*) from table1" -r rset1',
|
263
|
+
'sched:create sched1 "0 * * * *" -d example_db -q query.txt -r rset2'
|
263
264
|
add_list 'sched:delete', %w[name], 'Delete a schedule', 'sched:delete sched1'
|
264
265
|
add_list 'sched:update', %w[name], 'Modify a schedule', 'sched:update sched1 -s "0 */2 * * *" -d my_db -t "Asia/Tokyo" -D 3600'
|
265
266
|
add_list 'sched:history', %w[name max?], 'Show history of scheduled queries', 'sched sched1 --page 1'
|
data/lib/td/command/sched.rb
CHANGED
@@ -33,6 +33,7 @@ module Command
|
|
33
33
|
result_user = nil
|
34
34
|
result_ask_password = false
|
35
35
|
priority = nil
|
36
|
+
query = nil
|
36
37
|
retry_limit = nil
|
37
38
|
type = nil
|
38
39
|
|
@@ -63,6 +64,9 @@ module Command
|
|
63
64
|
raise "unknown priority #{s.inspect} should be -2 (very-low), -1 (low), 0 (normal), 1 (high) or 2 (very-high)"
|
64
65
|
end
|
65
66
|
}
|
67
|
+
op.on('-q', '--query PATH', 'use file instead of inline query') {|s|
|
68
|
+
query = File.open(s) { |f| f.read.strip }
|
69
|
+
}
|
66
70
|
op.on('-R', '--retry COUNT', 'automatic retrying count', Integer) {|i|
|
67
71
|
retry_limit = i
|
68
72
|
}
|
@@ -77,6 +81,17 @@ module Command
|
|
77
81
|
exit 1
|
78
82
|
end
|
79
83
|
|
84
|
+
if sql == '-'
|
85
|
+
sql = STDIN.read
|
86
|
+
elsif sql.nil?
|
87
|
+
sql = query
|
88
|
+
end
|
89
|
+
|
90
|
+
unless sql
|
91
|
+
$stderr.puts "<sql> argument or -q,--query PATH option is required."
|
92
|
+
exit 1
|
93
|
+
end
|
94
|
+
|
80
95
|
if result_url
|
81
96
|
require 'td/command/result'
|
82
97
|
result_url = build_result_url(result_url, result_user, result_ask_password)
|
data/lib/td/command/user.rb
CHANGED
@@ -135,11 +135,9 @@ module Command
|
|
135
135
|
|
136
136
|
ok = false
|
137
137
|
begin
|
138
|
-
client.add_user(name, org)
|
138
|
+
client.add_user(name, org, email, password)
|
139
139
|
|
140
140
|
begin
|
141
|
-
client.change_email(name, email)
|
142
|
-
client.change_password(name, password)
|
143
141
|
client.add_apikey(name)
|
144
142
|
ok = true
|
145
143
|
|
data/lib/td/version.rb
CHANGED
data/td.gemspec
CHANGED
@@ -19,8 +19,8 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_dependency "msgpack", "~> 0.4.4"
|
20
20
|
gem.add_dependency "yajl-ruby", "~> 1.1.0"
|
21
21
|
gem.add_dependency "hirb", ">= 0.4.5"
|
22
|
-
gem.add_dependency "parallel", "~> 0.
|
23
|
-
gem.add_dependency "td-client", "~> 0.8.
|
22
|
+
gem.add_dependency "parallel", "~> 0.6.1"
|
23
|
+
gem.add_dependency "td-client", "~> 0.8.50"
|
24
24
|
gem.add_dependency "td-logger", "~> 0.3.16"
|
25
25
|
gem.add_dependency "rubyzip", "~> 0.9.9"
|
26
26
|
gem.add_development_dependency "rake", "~> 0.9"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: td
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.78
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
69
|
+
version: 0.6.1
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +74,7 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.
|
77
|
+
version: 0.6.1
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: td-client
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.8.
|
85
|
+
version: 0.8.50
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0.8.
|
93
|
+
version: 0.8.50
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: td-logger
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,7 +262,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
262
262
|
version: '0'
|
263
263
|
segments:
|
264
264
|
- 0
|
265
|
-
hash:
|
265
|
+
hash: 2134623419874142893
|
266
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
267
267
|
none: false
|
268
268
|
requirements:
|
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
271
271
|
version: '0'
|
272
272
|
segments:
|
273
273
|
- 0
|
274
|
-
hash:
|
274
|
+
hash: 2134623419874142893
|
275
275
|
requirements: []
|
276
276
|
rubyforge_project:
|
277
277
|
rubygems_version: 1.8.23
|