td-client 0.8.30 → 0.8.31
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 +8 -8
- data/lib/td/client/api.rb +6 -3
- data/lib/td/client/model.rb +5 -3
- data/lib/td/client/version.rb +1 -1
- metadata +1 -1
data/ChangeLog
CHANGED
data/lib/td/client.rb
CHANGED
@@ -123,22 +123,22 @@ class Client
|
|
123
123
|
# => [Job]
|
124
124
|
def jobs(from=nil, to=nil, status=nil)
|
125
125
|
result = @api.list_jobs(from, to, status)
|
126
|
-
result.map {|job_id,type,status,query,start_at,end_at,result_url,priority,org|
|
127
|
-
Job.new(self, job_id, type, query, status, nil, nil, start_at, end_at, nil, result_url, nil, priority, org)
|
126
|
+
result.map {|job_id,type,status,query,start_at,end_at,result_url,priority,org,db|
|
127
|
+
Job.new(self, job_id, type, query, status, nil, nil, start_at, end_at, nil, result_url, nil, priority, org, db)
|
128
128
|
}
|
129
129
|
end
|
130
130
|
|
131
131
|
# => Job
|
132
132
|
def job(job_id)
|
133
133
|
job_id = job_id.to_s
|
134
|
-
type, query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority, org = @api.show_job(job_id)
|
135
|
-
Job.new(self, job_id, type, query, status, url, debug, start_at, end_at, nil, result_url, hive_result_schema, priority, org)
|
134
|
+
type, query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority, org, db = @api.show_job(job_id)
|
135
|
+
Job.new(self, job_id, type, query, status, url, debug, start_at, end_at, nil, result_url, hive_result_schema, priority, org, db)
|
136
136
|
end
|
137
137
|
|
138
138
|
# => type:Symbol, url:String
|
139
139
|
def job_status(job_id)
|
140
|
-
type, query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority, org = @api.show_job(job_id)
|
141
|
-
return query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority, org
|
140
|
+
type, query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority, org, db = @api.show_job(job_id)
|
141
|
+
return query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority, org, db
|
142
142
|
end
|
143
143
|
|
144
144
|
# => result:[{column:String=>value:Object]
|
@@ -259,9 +259,9 @@ class Client
|
|
259
259
|
# [ScheduledJob]
|
260
260
|
def history(name, from=nil, to=nil)
|
261
261
|
result = @api.history(name, from, to)
|
262
|
-
result.map {|scheduled_at,job_id,type,status,query,start_at,end_at,result_url,priority|
|
262
|
+
result.map {|scheduled_at,job_id,type,status,query,start_at,end_at,result_url,priority,database|
|
263
263
|
# TODO org
|
264
|
-
ScheduledJob.new(self, scheduled_at, job_id, type, query, status, nil, nil, start_at, end_at, nil, result_url, nil, priority)
|
264
|
+
ScheduledJob.new(self, scheduled_at, job_id, type, query, status, nil, nil, start_at, end_at, nil, result_url, nil, priority,nil,database)
|
265
265
|
}
|
266
266
|
end
|
267
267
|
|
data/lib/td/client/api.rb
CHANGED
@@ -339,6 +339,7 @@ class API
|
|
339
339
|
js['jobs'].each {|m|
|
340
340
|
job_id = m['job_id']
|
341
341
|
type = (m['type'] || '?').to_sym
|
342
|
+
database = m['database']
|
342
343
|
status = m['status']
|
343
344
|
query = m['query']
|
344
345
|
start_at = m['start_at']
|
@@ -346,7 +347,7 @@ class API
|
|
346
347
|
result_url = m['result']
|
347
348
|
priority = m['priority']
|
348
349
|
organization = m['organization']
|
349
|
-
result << [job_id, type, status, query, start_at, end_at, result_url, priority, organization]
|
350
|
+
result << [job_id, type, status, query, start_at, end_at, result_url, priority, organization, database]
|
350
351
|
}
|
351
352
|
return result
|
352
353
|
end
|
@@ -360,6 +361,7 @@ class API
|
|
360
361
|
js = checked_json(body, %w[status])
|
361
362
|
# TODO debug
|
362
363
|
type = (js['type'] || '?').to_sym # TODO
|
364
|
+
database = js['database']
|
363
365
|
query = js['query']
|
364
366
|
status = js['status']
|
365
367
|
debug = js['debug']
|
@@ -375,7 +377,7 @@ class API
|
|
375
377
|
end
|
376
378
|
priority = js['priority']
|
377
379
|
organization = js['organization']
|
378
|
-
return [type, query, status, url, debug, start_at, end_at, result, hive_result_schema, priority, organization]
|
380
|
+
return [type, query, status, url, debug, start_at, end_at, result, hive_result_schema, priority, organization, database]
|
379
381
|
end
|
380
382
|
|
381
383
|
def job_result(job_id)
|
@@ -697,6 +699,7 @@ class API
|
|
697
699
|
js['history'].each {|m|
|
698
700
|
job_id = m['job_id']
|
699
701
|
type = (m['type'] || '?').to_sym
|
702
|
+
database = m['database']
|
700
703
|
status = m['status']
|
701
704
|
query = m['query']
|
702
705
|
start_at = m['start_at']
|
@@ -704,7 +707,7 @@ class API
|
|
704
707
|
scheduled_at = m['scheduled_at']
|
705
708
|
result_url = m['result']
|
706
709
|
priority = m['priority']
|
707
|
-
result << [scheduled_at, job_id, type, status, query, start_at, end_at, result_url, priority]
|
710
|
+
result << [scheduled_at, job_id, type, status, query, start_at, end_at, result_url, priority, database]
|
708
711
|
}
|
709
712
|
return result
|
710
713
|
end
|
data/lib/td/client/model.rb
CHANGED
@@ -215,7 +215,7 @@ class Job < Model
|
|
215
215
|
STATUS_KILLED = "killed"
|
216
216
|
FINISHED_STATUS = [STATUS_SUCCESS, STATUS_ERROR, STATUS_KILLED]
|
217
217
|
|
218
|
-
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)
|
218
|
+
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, db_name=nil)
|
219
219
|
super(client)
|
220
220
|
@job_id = job_id
|
221
221
|
@type = type
|
@@ -230,10 +230,11 @@ class Job < Model
|
|
230
230
|
@hive_result_schema = hive_result_schema
|
231
231
|
@priority = priority
|
232
232
|
@org_name = org_name
|
233
|
+
@db_name = db_name
|
233
234
|
end
|
234
235
|
|
235
236
|
attr_reader :job_id, :type, :result_url
|
236
|
-
attr_reader :hive_result_schema, :priority, :org_name
|
237
|
+
attr_reader :hive_result_schema, :priority, :org_name, :db_name
|
237
238
|
|
238
239
|
def wait(timeout=nil)
|
239
240
|
# TODO
|
@@ -324,7 +325,7 @@ class Job < Model
|
|
324
325
|
end
|
325
326
|
|
326
327
|
def update_status!
|
327
|
-
query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority, org_name = @client.job_status(@job_id)
|
328
|
+
query, status, url, debug, start_at, end_at, result_url, hive_result_schema, priority, org_name, db_name = @client.job_status(@job_id)
|
328
329
|
@query = query
|
329
330
|
@status = status
|
330
331
|
@url = url
|
@@ -333,6 +334,7 @@ class Job < Model
|
|
333
334
|
@end_at = end_at
|
334
335
|
@hive_result_schema = hive_result_schema
|
335
336
|
@org_name = org_name
|
337
|
+
@db_name = db_name
|
336
338
|
self
|
337
339
|
end
|
338
340
|
end
|
data/lib/td/client/version.rb
CHANGED