td 0.9.6 → 0.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog CHANGED
@@ -1,4 +1,10 @@
1
1
 
2
+ == 2011-09-30 version 0.9.7
3
+
4
+ * Use local time zone at job:list and sched:history subcommands
5
+ * Updated dependency: td-logger-0.2.5
6
+
7
+
2
8
  == 2011-09-13 version 0.9.6
3
9
 
4
10
  * Implement main routine on TreasureData::Command::Runner to support heroku-td
@@ -52,7 +52,7 @@ module Command
52
52
  end
53
53
  elapsed = "% 10s" % elapsed # right aligned
54
54
 
55
- rows << {:JobID => job.job_id, :Status => job.status, :Query => job.query.to_s, :Start => start, :Elapsed => elapsed}
55
+ rows << {:JobID => job.job_id, :Status => job.status, :Query => job.query.to_s, :Start => start.localtime, :Elapsed => elapsed}
56
56
  }
57
57
 
58
58
  puts cmd_render_table(rows, :fields => [:JobID, :Status, :Start, :Elapsed, :Query])
@@ -191,6 +191,7 @@ module List
191
191
  add_list 'table:create', %w[db table], 'Create a table'
192
192
  add_list 'table:delete', %w[db table], 'Delete a table'
193
193
  add_list 'table:import', %w[db table files_], 'Parse and import files to a table'
194
+ #add_list 'table:tail', %w[db table], 'Get recently imported logs'
194
195
 
195
196
  add_list 'schema:show', %w[db table], 'Show schema of a table'
196
197
  add_list 'schema:set', %w[db table columns_?], 'Set new schema on a table'
@@ -99,7 +99,7 @@ module Command
99
99
 
100
100
  rows = []
101
101
  history.each {|j|
102
- rows << {:Time => j.scheduled_at, :JobID => j.job_id, :Status => j.status}
102
+ rows << {:Time => j.scheduled_at.localtime, :JobID => j.job_id, :Status => j.status}
103
103
  }
104
104
 
105
105
  puts cmd_render_table(rows, :fields => [:JobID, :Time, :Status])
@@ -101,6 +101,35 @@ module Command
101
101
  puts ")"
102
102
  end
103
103
 
104
+ def table_tail(op)
105
+ from = nil
106
+ to = nil
107
+ num = 80
108
+
109
+ op.on('-f', '--from TIME', 'start time of logs to get') {|s|
110
+ from = Time.parse(s).to_i
111
+ }
112
+ op.on('-t', '--to TIME', 'end time of logs to get') {|s|
113
+ to = Time.parse(s).to_i
114
+ }
115
+ op.on('-n', '--num N', 'number of logs to get', Integer) {|i|
116
+ num = i
117
+ }
118
+
119
+ db_name, table_name = op.cmd_parse
120
+
121
+ client = get_client
122
+
123
+ table = get_table(client, db_name, table_name)
124
+
125
+ rows = table.tail(num, to, from)
126
+
127
+ require 'json'
128
+ rows.each {|row|
129
+ puts row.to_json
130
+ }
131
+ end
132
+
104
133
  require 'td/command/import' # table:import
105
134
  end
106
135
  end
@@ -1,5 +1,5 @@
1
1
  module TreasureData
2
2
 
3
- VERSION = '0.9.6'
3
+ VERSION = '0.9.7'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: td
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 6
10
- version: 0.9.6
9
+ - 7
10
+ version: 0.9.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sadayuki Furuhashi
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-20 00:00:00 +09:00
18
+ date: 2011-09-30 00:00:00 +09:00
19
19
  default_executable: td
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -90,12 +90,12 @@ dependencies:
90
90
  requirements:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
- hash: 31
93
+ hash: 29
94
94
  segments:
95
95
  - 0
96
96
  - 2
97
- - 4
98
- version: 0.2.4
97
+ - 5
98
+ version: 0.2.5
99
99
  type: :runtime
100
100
  version_requirements: *id005
101
101
  description: