td-client 0.8.21 → 0.8.22
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -0
- data/lib/td/client.rb +15 -14
- data/lib/td/client/api.rb +9 -5
- data/lib/td/client/model.rb +17 -8
- data/lib/td/client/version.rb +1 -1
- metadata +2 -2
data/ChangeLog
CHANGED
data/lib/td/client.rb
CHANGED
@@ -44,17 +44,17 @@ class Client
|
|
44
44
|
# => [Database]
|
45
45
|
def databases
|
46
46
|
m = @api.list_databases
|
47
|
-
m.map {|db_name,(count,created_at,updated_at)|
|
48
|
-
Database.new(self, db_name, nil, count, created_at, updated_at)
|
47
|
+
m.map {|db_name,(count,created_at,updated_at,org)|
|
48
|
+
Database.new(self, db_name, nil, count, created_at, updated_at, org)
|
49
49
|
}
|
50
50
|
end
|
51
51
|
|
52
52
|
# => Database
|
53
53
|
def database(db_name)
|
54
54
|
m = @api.list_databases
|
55
|
-
m.each {|name,(count,created_at,updated_at)|
|
55
|
+
m.each {|name,(count,created_at,updated_at,org)|
|
56
56
|
if name == db_name
|
57
|
-
return Database.new(self, name, nil, count, created_at, updated_at)
|
57
|
+
return Database.new(self, name, nil, count, created_at, updated_at, org)
|
58
58
|
end
|
59
59
|
}
|
60
60
|
raise NotFoundError, "Database '#{db_name}' does not exist"
|
@@ -112,22 +112,22 @@ class Client
|
|
112
112
|
# => [Job]
|
113
113
|
def jobs(from=nil, to=nil, status=nil)
|
114
114
|
result = @api.list_jobs(from, to, status)
|
115
|
-
result.map {|job_id,type,status,query,start_at,end_at,result_url,priority|
|
116
|
-
Job.new(self, job_id, type, query, status, nil, nil, start_at, end_at, nil, result_url, nil, priority)
|
115
|
+
result.map {|job_id,type,status,query,start_at,end_at,result_url,priority,org|
|
116
|
+
Job.new(self, job_id, type, query, status, nil, nil, start_at, end_at, nil, result_url, nil, priority, org)
|
117
117
|
}
|
118
118
|
end
|
119
119
|
|
120
120
|
# => Job
|
121
121
|
def job(job_id)
|
122
122
|
job_id = job_id.to_s
|
123
|
-
type, query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority = @api.show_job(job_id)
|
124
|
-
Job.new(self, job_id, type, query, status, url, debug, start_at, end_at, nil, result_url, hive_result_schema, priority)
|
123
|
+
type, query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority, org = @api.show_job(job_id)
|
124
|
+
Job.new(self, job_id, type, query, status, url, debug, start_at, end_at, nil, result_url, hive_result_schema, priority, org)
|
125
125
|
end
|
126
126
|
|
127
127
|
# => type:Symbol, url:String
|
128
128
|
def job_status(job_id)
|
129
|
-
type, query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority = @api.show_job(job_id)
|
130
|
-
return query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority
|
129
|
+
type, query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority, org = @api.show_job(job_id)
|
130
|
+
return query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority, org
|
131
131
|
end
|
132
132
|
|
133
133
|
# => result:[{column:String=>value:Object]
|
@@ -235,8 +235,8 @@ class Client
|
|
235
235
|
# [Schedule]
|
236
236
|
def schedules
|
237
237
|
result = @api.list_schedules
|
238
|
-
result.map {|name,cron,query,database,result_url,timezone,delay,next_time,priority|
|
239
|
-
Schedule.new(self, name, cron, query, database, result_url, timezone, delay, next_time, priority)
|
238
|
+
result.map {|name,cron,query,database,result_url,timezone,delay,next_time,priority,org_name|
|
239
|
+
Schedule.new(self, name, cron, query, database, result_url, timezone, delay, next_time, priority, org_name)
|
240
240
|
}
|
241
241
|
end
|
242
242
|
|
@@ -249,6 +249,7 @@ class Client
|
|
249
249
|
def history(name, from=nil, to=nil)
|
250
250
|
result = @api.history(name, from, to)
|
251
251
|
result.map {|scheduled_at,job_id,type,status,query,start_at,end_at,result_url,priority|
|
252
|
+
# TODO org
|
252
253
|
ScheduledJob.new(self, scheduled_at, job_id, type, query, status, nil, nil, start_at, end_at, nil, result_url, nil, priority)
|
253
254
|
}
|
254
255
|
end
|
@@ -269,8 +270,8 @@ class Client
|
|
269
270
|
# => [Result]
|
270
271
|
def results
|
271
272
|
results = @api.list_result
|
272
|
-
rs = results.map {|name,url|
|
273
|
-
Result.new(self, name, url)
|
273
|
+
rs = results.map {|name,url,organizations|
|
274
|
+
Result.new(self, name, url, organizations)
|
274
275
|
}
|
275
276
|
return rs
|
276
277
|
end
|
data/lib/td/client/api.rb
CHANGED
@@ -146,7 +146,8 @@ class API
|
|
146
146
|
count = m['count']
|
147
147
|
created_at = m['created_at']
|
148
148
|
updated_at = m['updated_at']
|
149
|
-
|
149
|
+
organization = m['organization']
|
150
|
+
result[name] = [count, created_at, updated_at, organization]
|
150
151
|
}
|
151
152
|
return result
|
152
153
|
end
|
@@ -291,7 +292,8 @@ class API
|
|
291
292
|
end_at = m['end_at']
|
292
293
|
result_url = m['result']
|
293
294
|
priority = m['priority']
|
294
|
-
|
295
|
+
organization = m['organization']
|
296
|
+
result << [job_id, type, status, query, start_at, end_at, result_url, priority, organization]
|
295
297
|
}
|
296
298
|
return result
|
297
299
|
end
|
@@ -319,7 +321,8 @@ class API
|
|
319
321
|
hive_result_schema = JSON.parse(hive_result_schema)
|
320
322
|
end
|
321
323
|
priority = js['priority']
|
322
|
-
|
324
|
+
organization = js['organization']
|
325
|
+
return [type, query, status, url, debug, start_at, end_at, result, hive_result_schema, priority, organization]
|
323
326
|
end
|
324
327
|
|
325
328
|
def job_result(job_id)
|
@@ -614,7 +617,8 @@ class API
|
|
614
617
|
delay = m['delay']
|
615
618
|
next_time = m['next_time']
|
616
619
|
priority = m['priority']
|
617
|
-
|
620
|
+
organization = m['organization']
|
621
|
+
result << [name, cron, query, database, result_url, timezone, delay, next_time, priority, organization]
|
618
622
|
}
|
619
623
|
return result
|
620
624
|
end
|
@@ -698,7 +702,7 @@ class API
|
|
698
702
|
js = checked_json(body, %w[results])
|
699
703
|
result = []
|
700
704
|
js['results'].map {|m|
|
701
|
-
result << [m['name'], m['url']]
|
705
|
+
result << [m['name'], m['url'], m['organization']]
|
702
706
|
}
|
703
707
|
return result
|
704
708
|
end
|
data/lib/td/client/model.rb
CHANGED
@@ -11,15 +11,18 @@ class Model
|
|
11
11
|
end
|
12
12
|
|
13
13
|
class Database < Model
|
14
|
-
def initialize(client, db_name, tables=nil, count=nil, created_at=nil, updated_at=nil)
|
14
|
+
def initialize(client, db_name, tables=nil, count=nil, created_at=nil, updated_at=nil, org_name=nil)
|
15
15
|
super(client)
|
16
16
|
@db_name = db_name
|
17
17
|
@tables = tables
|
18
18
|
@count = count
|
19
19
|
@created_at = created_at
|
20
20
|
@updated_at = updated_at
|
21
|
+
@org_name = org_name
|
21
22
|
end
|
22
23
|
|
24
|
+
attr_reader :org_name
|
25
|
+
|
23
26
|
def name
|
24
27
|
@db_name
|
25
28
|
end
|
@@ -175,7 +178,7 @@ class Job < Model
|
|
175
178
|
STATUS_KILLED = "killed"
|
176
179
|
FINISHED_STATUS = [STATUS_SUCCESS, STATUS_ERROR, STATUS_KILLED]
|
177
180
|
|
178
|
-
def initialize(client, job_id, type, query, status=nil, url=nil, debug=nil, start_at=nil, end_at=nil, result=nil, result_url=nil, hive_result_schema=nil, priority=nil)
|
181
|
+
def initialize(client, job_id, type, query, status=nil, url=nil, debug=nil, start_at=nil, end_at=nil, result=nil, result_url=nil, hive_result_schema=nil, priority=nil, org_name=nil)
|
179
182
|
super(client)
|
180
183
|
@job_id = job_id
|
181
184
|
@type = type
|
@@ -189,10 +192,11 @@ class Job < Model
|
|
189
192
|
@result_url = result_url
|
190
193
|
@hive_result_schema = hive_result_schema
|
191
194
|
@priority = priority
|
195
|
+
@org_name = org_name
|
192
196
|
end
|
193
197
|
|
194
198
|
attr_reader :job_id, :type, :result_url
|
195
|
-
attr_reader :hive_result_schema, :priority
|
199
|
+
attr_reader :hive_result_schema, :priority, :org_name
|
196
200
|
|
197
201
|
def wait(timeout=nil)
|
198
202
|
# TODO
|
@@ -283,7 +287,7 @@ class Job < Model
|
|
283
287
|
end
|
284
288
|
|
285
289
|
def update_status!
|
286
|
-
query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority = @client.job_status(@job_id)
|
290
|
+
query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority, org_name = @client.job_status(@job_id)
|
287
291
|
@query = query
|
288
292
|
@status = status
|
289
293
|
@url = url
|
@@ -291,6 +295,7 @@ class Job < Model
|
|
291
295
|
@start_at = start_at
|
292
296
|
@end_at = end_at
|
293
297
|
@hive_result_schema = hive_result_schema
|
298
|
+
@org_name = org_name
|
294
299
|
self
|
295
300
|
end
|
296
301
|
end
|
@@ -309,7 +314,7 @@ end
|
|
309
314
|
|
310
315
|
|
311
316
|
class Schedule < Model
|
312
|
-
def initialize(client, name, cron, query, database=nil, result_url=nil, timezone=nil, delay=nil, next_time=nil, priority=nil)
|
317
|
+
def initialize(client, name, cron, query, database=nil, result_url=nil, timezone=nil, delay=nil, next_time=nil, priority=nil, org_name=nil)
|
313
318
|
super(client)
|
314
319
|
@name = name
|
315
320
|
@cron = cron
|
@@ -320,9 +325,10 @@ class Schedule < Model
|
|
320
325
|
@delay = delay
|
321
326
|
@next_time = next_time
|
322
327
|
@priority = priority
|
328
|
+
@org_name = org_name
|
323
329
|
end
|
324
330
|
|
325
|
-
attr_reader :name, :cron, :query, :database, :result_url, :timezone, :delay, :priority
|
331
|
+
attr_reader :name, :cron, :query, :database, :result_url, :timezone, :delay, :priority, :org_name
|
326
332
|
|
327
333
|
def next_time
|
328
334
|
@next_time ? Time.parse(@next_time) : nil
|
@@ -335,13 +341,14 @@ end
|
|
335
341
|
|
336
342
|
|
337
343
|
class Result < Model
|
338
|
-
def initialize(client, name, url)
|
344
|
+
def initialize(client, name, url, org_name)
|
339
345
|
super(client)
|
340
346
|
@name = name
|
341
347
|
@url = url
|
348
|
+
@org_name = org_name
|
342
349
|
end
|
343
350
|
|
344
|
-
attr_reader :name, :url
|
351
|
+
attr_reader :name, :url, :org_name
|
345
352
|
end
|
346
353
|
|
347
354
|
|
@@ -358,6 +365,7 @@ class BulkImport < Model
|
|
358
365
|
@error_records = data['error_records']
|
359
366
|
@valid_parts = data['valid_parts']
|
360
367
|
@error_parts = data['error_parts']
|
368
|
+
@org_name = data['organization']
|
361
369
|
end
|
362
370
|
|
363
371
|
attr_reader :name
|
@@ -369,6 +377,7 @@ class BulkImport < Model
|
|
369
377
|
attr_reader :error_records
|
370
378
|
attr_reader :valid_parts
|
371
379
|
attr_reader :error_parts
|
380
|
+
attr_reader :org_name
|
372
381
|
|
373
382
|
def upload_frozen?
|
374
383
|
@upload_frozen
|
data/lib/td/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: td-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.22
|
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-08-
|
12
|
+
date: 2012-08-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|