td 0.10.61 → 0.10.62

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ == 2012-12-05 version 0.10.62
2
+
3
+ * Add --slow option to job:list subcommand.
4
+
5
+
1
6
  == 2012-11-19 version 0.10.61
2
7
 
3
8
  * Add --auto-create-table option to table:import subcommand. issue #9
@@ -52,7 +52,7 @@ Then run following commands on MinGW Shell:
52
52
  $ mingw-get install msys-vim
53
53
  $ mingw-get install msys-wget
54
54
  $ gem install bundler
55
- $ rake exe:build
55
+ $ bundle exec rake exe:build
56
56
 
57
57
 
58
58
  = Copyright
@@ -45,7 +45,7 @@ module Command
45
45
 
46
46
  client.revoke_access_control(subject, action, scope)
47
47
 
48
- $stderr.puts "Access control [#{subject} #{action} #{scope}] is created."
48
+ $stderr.puts "Access control [#{subject} #{action} #{scope}] is removed."
49
49
  end
50
50
 
51
51
  # TODO acl_test
@@ -30,6 +30,7 @@ module Command
30
30
  page = 0
31
31
  skip = 0
32
32
  status = nil
33
+ slower_than = nil
33
34
 
34
35
  op.on('-p', '--page PAGE', 'skip N pages', Integer) {|i|
35
36
  page = i
@@ -46,6 +47,9 @@ module Command
46
47
  op.on('-E', '--error', 'show only failed jobs', TrueClass) {|b|
47
48
  status = 'error'
48
49
  }
50
+ op.on('--slow [SECONDS]', 'show slow queries (default threshold: 3600 seconds)', Integer) { |i|
51
+ slower_than = i || 3600
52
+ }
49
53
 
50
54
  max = op.cmd_parse
51
55
 
@@ -56,7 +60,13 @@ module Command
56
60
  if page
57
61
  skip += max * page
58
62
  end
59
- jobs = client.jobs(skip, skip+max-1, status)
63
+
64
+ conditions = nil
65
+ if slower_than
66
+ conditions = {:slower_than => slower_than}
67
+ end
68
+
69
+ jobs = client.jobs(skip, skip+max-1, status, conditions)
60
70
 
61
71
  rows = []
62
72
  has_org = false
@@ -69,6 +69,13 @@ module Command
69
69
  end
70
70
 
71
71
  def table_list(op)
72
+ require 'parallel'
73
+
74
+ num_threads = 4
75
+ op.on('-n', '--num_threads VAL', 'number of threads to get list in parallel') { |i|
76
+ num_threads = Integer(i)
77
+ }
78
+
72
79
  db_name = op.cmd_parse
73
80
 
74
81
  client = get_client
@@ -81,7 +88,7 @@ module Command
81
88
  end
82
89
 
83
90
  rows = []
84
- dbs.each {|db|
91
+ ::Parallel.each(dbs, :in_threads => num_threads) {|db|
85
92
  db.tables.each {|table|
86
93
  pschema = table.schema.fields.map {|f|
87
94
  "#{f.name}:#{f.type}"
@@ -1,5 +1,5 @@
1
1
  module TreasureData
2
2
 
3
- VERSION = '0.10.61'
3
+ VERSION = '0.10.62'
4
4
 
5
5
  end
data/td.gemspec CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.add_dependency "msgpack", "~> 0.4.4"
20
20
  gem.add_dependency "hirb", ">= 0.4.5"
21
+ gem.add_dependency "parallel", "~> 0.5.19"
21
22
  gem.add_dependency "td-client", "~> 0.8.37"
22
23
  gem.add_dependency "td-logger", "~> 0.3.16"
23
24
  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.61
4
+ version: 0.10.62
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: 2012-11-19 00:00:00.000000000 Z
12
+ date: 2012-12-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: msgpack
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: 0.4.5
46
+ - !ruby/object:Gem::Dependency
47
+ name: parallel
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 0.5.19
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.5.19
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: td-client
48
64
  requirement: !ruby/object:Gem::Requirement