td 0.10.67 → 0.10.68
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -0
- data/README.rdoc +3 -1
- data/build/update-td.sh +2 -2
- data/java/{td-0.1.1-SNAPSHOT.jar → td-0.1.1.jar} +0 -0
- data/java/td_java.version +1 -1
- data/lib/td/command/bulk_import.rb +13 -8
- data/lib/td/command/common.rb +8 -0
- data/lib/td/command/db.rb +10 -2
- data/lib/td/command/export.rb +5 -0
- data/lib/td/command/job.rb +1 -1
- data/lib/td/command/query.rb +7 -1
- data/lib/td/command/result.rb +8 -2
- data/lib/td/command/sched.rb +6 -2
- data/lib/td/command/table.rb +7 -1
- data/lib/td/version.rb +1 -1
- metadata +3 -3
data/ChangeLog
CHANGED
data/README.rdoc
CHANGED
@@ -46,13 +46,15 @@ Install following binary packages:
|
|
46
46
|
* MinGW with MSYS Basic System and using mingw-get-inst
|
47
47
|
* Git for Windows, with Windows Command Prompt support
|
48
48
|
* Ruby 1.9.2 using RubyInstaller for Windows, with PATH update
|
49
|
+
* Inno Setup 5
|
49
50
|
|
50
51
|
Then run following commands on MinGW Shell:
|
51
52
|
|
52
53
|
$ mingw-get install msys-vim
|
53
54
|
$ mingw-get install msys-wget
|
54
55
|
$ gem install bundler
|
55
|
-
$ bundle
|
56
|
+
$ bundle install # don't use "--path" option
|
57
|
+
$ rake exe:build # don't use "bundle exec"
|
56
58
|
|
57
59
|
|
58
60
|
= Copyright
|
data/build/update-td.sh
CHANGED
@@ -21,7 +21,7 @@ fi
|
|
21
21
|
revname="$(git show --pretty=format:'%H %ad' | head -n 1)"
|
22
22
|
|
23
23
|
mvn package -Dmaven.test.skip=true || exit 1
|
24
|
-
cp target/td-0.1.1
|
24
|
+
cp target/td-0.1.1.jar ../../java/td-0.1.1.jar
|
25
25
|
|
26
26
|
if [ -n "$chrev" ];then
|
27
27
|
git checkout master
|
@@ -33,5 +33,5 @@ echo "$revname" > java/td_java.version
|
|
33
33
|
|
34
34
|
echo ""
|
35
35
|
echo "git commit ./java -m \"updated td-java $revname\""
|
36
|
-
git commit ./java/td-0.1.1
|
36
|
+
git commit ./java/td-0.1.1.jar ./java/td_java.version -m "updated td-java $revname" || exit 1
|
37
37
|
|
Binary file
|
data/java/td_java.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
19238aa12ef2b06cc07f4dc5cd008d35da1aa358 Tue Jan 22 21:46:12 2013 +0900
|
@@ -16,7 +16,7 @@ module Command
|
|
16
16
|
has_org = true if bi.org_name
|
17
17
|
}
|
18
18
|
|
19
|
-
puts cmd_render_table(rows, :fields => (has_org
|
19
|
+
puts cmd_render_table(rows, :fields => gen_table_fields(has_org, [:Name, :Table, :Status, :Frozen, :JobID, :"Valid Parts", :"Error Parts", :"Valid Records", :"Error Records"]), :max_width=>200)
|
20
20
|
|
21
21
|
if rows.empty?
|
22
22
|
$stderr.puts "There are no bulk import sessions."
|
@@ -25,13 +25,21 @@ module Command
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def bulk_import_create(op)
|
28
|
+
org = nil
|
29
|
+
|
30
|
+
op.on('-g', '--org ORGANIZATION', "create the database under this organization") {|s|
|
31
|
+
org = s
|
32
|
+
}
|
33
|
+
|
28
34
|
name, db_name, table_name = op.cmd_parse
|
29
35
|
|
30
36
|
client = get_client
|
31
37
|
|
32
38
|
table = get_table(client, db_name, table_name)
|
33
39
|
|
34
|
-
|
40
|
+
opts = {}
|
41
|
+
opts['organization'] = org if org
|
42
|
+
client.create_bulk_import(name, db_name, table_name, opts)
|
35
43
|
|
36
44
|
$stderr.puts "Bulk import session '#{name}' is created."
|
37
45
|
end
|
@@ -460,7 +468,7 @@ module Command
|
|
460
468
|
|
461
469
|
# make application options
|
462
470
|
app_opts = []
|
463
|
-
app_opts << "-cp
|
471
|
+
app_opts << "-cp \"#{td_command_jar}\""
|
464
472
|
|
465
473
|
# make system properties
|
466
474
|
sysprops = []
|
@@ -479,13 +487,10 @@ module Command
|
|
479
487
|
app_args << 'prepare_parts'
|
480
488
|
app_args << files
|
481
489
|
|
490
|
+
# TODO consider parameters including spaces; don't use join(' ')
|
482
491
|
command = "#{javacmd} #{jvm_opts.join(' ')} #{app_opts.join(' ')} #{sysprops.join(' ')} #{app_args.join(' ')}"
|
483
492
|
|
484
|
-
|
485
|
-
exec(command)
|
486
|
-
rescue
|
487
|
-
exit 1
|
488
|
-
end
|
493
|
+
exec command
|
489
494
|
end
|
490
495
|
|
491
496
|
private
|
data/lib/td/command/common.rb
CHANGED
@@ -33,6 +33,14 @@ module Command
|
|
33
33
|
Hirb::Helpers::Table.render(rows, *opts)
|
34
34
|
end
|
35
35
|
|
36
|
+
def gen_table_fields(has_org, fields)
|
37
|
+
if has_org
|
38
|
+
fields.unshift(:Organization)
|
39
|
+
else
|
40
|
+
fields
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
36
44
|
#def cmd_render_tree(nodes, *opts)
|
37
45
|
# require 'hirb'
|
38
46
|
# Hirb::Helpers::Tree.render(nodes, *opts)
|
data/lib/td/command/db.rb
CHANGED
@@ -35,7 +35,7 @@ module Command
|
|
35
35
|
rows << {:Name=>db.name, :Count=>db.count, :Organization=>db.org_name}
|
36
36
|
has_org = true if db.org_name
|
37
37
|
}
|
38
|
-
puts cmd_render_table(rows, :fields => (has_org
|
38
|
+
puts cmd_render_table(rows, :fields => gen_table_fields(has_org, [:Name, :Count]))
|
39
39
|
|
40
40
|
if dbs.empty?
|
41
41
|
$stderr.puts "There are no databases."
|
@@ -44,14 +44,22 @@ module Command
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def db_create(op)
|
47
|
+
org = nil
|
48
|
+
|
49
|
+
op.on('-g', '--org ORGANIZATION', "create the database under this organization") {|s|
|
50
|
+
org = s
|
51
|
+
}
|
52
|
+
|
47
53
|
db_name = op.cmd_parse
|
48
54
|
|
49
55
|
API.validate_database_name(db_name)
|
50
56
|
|
51
57
|
client = get_client
|
52
58
|
|
59
|
+
opts = {}
|
60
|
+
opts['organization'] = org if org
|
53
61
|
begin
|
54
|
-
client.create_database(db_name)
|
62
|
+
client.create_database(db_name, opts)
|
55
63
|
rescue AlreadyExistsError
|
56
64
|
$stderr.puts "Database '#{db_name}' already exists."
|
57
65
|
exit 1
|
data/lib/td/command/export.rb
CHANGED
@@ -3,6 +3,7 @@ module TreasureData
|
|
3
3
|
module Command
|
4
4
|
|
5
5
|
def table_export(op)
|
6
|
+
org = nil
|
6
7
|
from = nil
|
7
8
|
to = nil
|
8
9
|
s3_bucket = nil
|
@@ -10,6 +11,9 @@ module Command
|
|
10
11
|
aws_secret_access_key = nil
|
11
12
|
file_format = "json.gz"
|
12
13
|
|
14
|
+
op.on('-g', '--org ORGANIZATION', "export the data under this organization") {|s|
|
15
|
+
org = s
|
16
|
+
}
|
13
17
|
op.on('-f', '--from TIME', 'export data which is newer than or same with the TIME') {|s|
|
14
18
|
from = export_parse_time(s)
|
15
19
|
}
|
@@ -50,6 +54,7 @@ module Command
|
|
50
54
|
client = get_ssl_client
|
51
55
|
|
52
56
|
s3_opts = {}
|
57
|
+
s3_opts['organization'] = org if org
|
53
58
|
s3_opts['from'] = from.to_s if from
|
54
59
|
s3_opts['to'] = to.to_s if to
|
55
60
|
s3_opts['file_format'] = file_format
|
data/lib/td/command/job.rb
CHANGED
@@ -78,7 +78,7 @@ module Command
|
|
78
78
|
has_org = true if job.org_name
|
79
79
|
}
|
80
80
|
|
81
|
-
puts cmd_render_table(rows, :fields => (has_org
|
81
|
+
puts cmd_render_table(rows, :fields => gen_table_fields(has_org, [:JobID, :Status, :Start, :Elapsed, :Priority, :Result, :Type, :Database, :Query]), :max_width => 140)
|
82
82
|
end
|
83
83
|
|
84
84
|
def job_show(op)
|
data/lib/td/command/query.rb
CHANGED
@@ -3,6 +3,7 @@ module TreasureData
|
|
3
3
|
module Command
|
4
4
|
|
5
5
|
def query(op)
|
6
|
+
org = nil
|
6
7
|
db_name = nil
|
7
8
|
wait = false
|
8
9
|
output = nil
|
@@ -14,6 +15,9 @@ module Command
|
|
14
15
|
priority = nil
|
15
16
|
retry_limit = nil
|
16
17
|
|
18
|
+
op.on('-g', '--org ORGANIZATION', "issue the query under this organization") {|s|
|
19
|
+
org = s
|
20
|
+
}
|
17
21
|
op.on('-d', '--database DB_NAME', 'use the database (required)') {|s|
|
18
22
|
db_name = s
|
19
23
|
}
|
@@ -72,7 +76,9 @@ module Command
|
|
72
76
|
# local existance check
|
73
77
|
get_database(client, db_name)
|
74
78
|
|
75
|
-
|
79
|
+
opts = {}
|
80
|
+
opts['organization'] = org if org
|
81
|
+
job = client.query(db_name, sql, result_url, priority, retry_limit, opts)
|
76
82
|
|
77
83
|
$stderr.puts "Job #{job.job_id} is queued."
|
78
84
|
$stderr.puts "Use '#{$prog} job:show #{job.job_id}' to show the status."
|
data/lib/td/command/result.rb
CHANGED
@@ -38,7 +38,7 @@ module Command
|
|
38
38
|
map[:Name]
|
39
39
|
}
|
40
40
|
|
41
|
-
puts cmd_render_table(rows, :fields => (has_org
|
41
|
+
puts cmd_render_table(rows, :fields => gen_table_fields(has_org, [:Name, :URL]))
|
42
42
|
|
43
43
|
if rs.empty?
|
44
44
|
$stderr.puts "There are no result URLs."
|
@@ -47,9 +47,13 @@ module Command
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def result_create(op)
|
50
|
+
org = nil
|
50
51
|
result_user = nil
|
51
52
|
result_ask_password = false
|
52
53
|
|
54
|
+
op.on('-g', '--org ORGANIZATION', "create the database under this organization") {|s|
|
55
|
+
org = s
|
56
|
+
}
|
53
57
|
op.on('-u', '--user NAME', 'set user name for authentication') {|s|
|
54
58
|
result_user = s
|
55
59
|
}
|
@@ -65,8 +69,10 @@ module Command
|
|
65
69
|
|
66
70
|
url = build_result_url(url, result_user, result_ask_password)
|
67
71
|
|
72
|
+
opts = {}
|
73
|
+
opts['organization'] = org if org
|
68
74
|
begin
|
69
|
-
client.create_result(name, url)
|
75
|
+
client.create_result(name, url, opts)
|
70
76
|
rescue AlreadyExistsError
|
71
77
|
$stderr.puts "Result URL '#{name}' already exists."
|
72
78
|
exit 1
|
data/lib/td/command/sched.rb
CHANGED
@@ -21,10 +21,11 @@ module Command
|
|
21
21
|
map[:Name]
|
22
22
|
}
|
23
23
|
|
24
|
-
puts cmd_render_table(rows, :fields => (has_org
|
24
|
+
puts cmd_render_table(rows, :fields => gen_table_fields(has_org, [:Name, :Cron, :Timezone, :"Next schedule", :Delay, :Priority, :Result, :Database, :Query]), :max_width=>500)
|
25
25
|
end
|
26
26
|
|
27
27
|
def sched_create(op)
|
28
|
+
org = nil
|
28
29
|
db_name = nil
|
29
30
|
timezone = nil
|
30
31
|
delay = 0
|
@@ -34,6 +35,9 @@ module Command
|
|
34
35
|
priority = nil
|
35
36
|
retry_limit = nil
|
36
37
|
|
38
|
+
op.on('-g', '--org ORGANIZATION', "create the schedule under this organization") {|s|
|
39
|
+
org = s
|
40
|
+
}
|
37
41
|
op.on('-d', '--database DB_NAME', 'use the database (required)') {|s|
|
38
42
|
db_name = s
|
39
43
|
}
|
@@ -80,7 +84,7 @@ module Command
|
|
80
84
|
get_database(client, db_name)
|
81
85
|
|
82
86
|
begin
|
83
|
-
first_time = client.create_schedule(name, :cron=>cron, :query=>sql, :database=>db_name, :result=>result_url, :timezone=>timezone, :delay=>delay, :priority=>priority, :retry_limit=>retry_limit)
|
87
|
+
first_time = client.create_schedule(name, :cron=>cron, :query=>sql, :database=>db_name, :result=>result_url, :timezone=>timezone, :delay=>delay, :priority=>priority, :retry_limit=>retry_limit, :organization=>org)
|
84
88
|
rescue AlreadyExistsError
|
85
89
|
cmd_debug_error $!
|
86
90
|
$stderr.puts "Schedule '#{name}' already exists."
|
data/lib/td/command/table.rb
CHANGED
@@ -275,10 +275,14 @@ module Command
|
|
275
275
|
end
|
276
276
|
|
277
277
|
def table_partial_delete(op)
|
278
|
+
org = nil
|
278
279
|
from = nil
|
279
280
|
to = nil
|
280
281
|
wait = false
|
281
282
|
|
283
|
+
op.on('-g', '--org ORGANIZATION', "delete data partially under this organization") {|s|
|
284
|
+
org = s
|
285
|
+
}
|
282
286
|
op.on('-t', '--to TIME', 'end time of logs to delete') {|s|
|
283
287
|
if s.to_i.to_s == s
|
284
288
|
# UNIX time
|
@@ -321,7 +325,9 @@ module Command
|
|
321
325
|
|
322
326
|
table = get_table(client, db_name, table_name)
|
323
327
|
|
324
|
-
|
328
|
+
opts = {}
|
329
|
+
opts['organization'] = org if org
|
330
|
+
job = client.partial_delete(db_name, table_name, to, from, opts)
|
325
331
|
|
326
332
|
$stderr.puts "Partial delete job #{job.job_id} is queued."
|
327
333
|
$stderr.puts "Use '#{$prog} job:show #{job.job_id}' to show the status."
|
data/lib/td/version.rb
CHANGED
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.68
|
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-01-
|
12
|
+
date: 2013-01-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|
@@ -181,7 +181,7 @@ files:
|
|
181
181
|
- dist/resources/pkg/PackageInfo.erb
|
182
182
|
- dist/resources/pkg/postinstall
|
183
183
|
- dist/resources/pkg/td
|
184
|
-
- java/td-0.1.1
|
184
|
+
- java/td-0.1.1.jar
|
185
185
|
- java/td_java.version
|
186
186
|
- lib/td.rb
|
187
187
|
- lib/td/command/account.rb
|