Class: DruidConfig::Entities::Task
- Inherits:
-
Object
- Object
- DruidConfig::Entities::Task
- Includes:
- Util, HTTParty
- Defined in:
- lib/druid_config/entities/task.rb
Overview
Init a DataSource
Constant Summary collapse
- STATUS =
Statuses constants
{ running: 'RUNNING', pending: 'PENDING', success: 'SUCCESS', waiting: 'WAITING', failed: 'FAILED' }
Instance Attribute Summary collapse
-
#created_time ⇒ Object
readonly
Returns the value of attribute created_time.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#query_insertion_time ⇒ Object
readonly
Returns the value of attribute query_insertion_time.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
-
.find(id) ⇒ Object
Find a task based on id.
Instance Method Summary collapse
-
#datasource ⇒ Object
Get the dataSource of this task.
-
#group_id ⇒ Object
Group of the task.
-
#initialize(id, status, extended_info = {}) ⇒ Task
constructor
Initialize a task.
-
#log ⇒ Object
Current log of a task.
-
#payload ⇒ Object
Get payload of the task.
Methods included from Util
#pop_uri, #query_overlord, #secure_query, #stash_uri
Constructor Details
#initialize(id, status, extended_info = {}) ⇒ Task
Initialize a task
Parameters:
- id
-
String with identifier
- status
-
Current status of the task
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/druid_config/entities/task.rb', line 46 def initialize(id, status, extended_info = {}) @id = id @status = status.downcase.to_sym @created_time = extended_info[:created_time] @query_insertion_time = extended_info[:query_insertion_time] # Set end point for HTTParty self.class.base_uri( "#{DruidConfig.client.overlord}"\ "druid/indexer/#{DruidConfig::Version::API_VERSION}/task") end |
Instance Attribute Details
#created_time ⇒ Object (readonly)
Returns the value of attribute created_time.
22 23 24 |
# File 'lib/druid_config/entities/task.rb', line 22 def created_time @created_time end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
22 23 24 |
# File 'lib/druid_config/entities/task.rb', line 22 def id @id end |
#query_insertion_time ⇒ Object (readonly)
Returns the value of attribute query_insertion_time.
22 23 24 |
# File 'lib/druid_config/entities/task.rb', line 22 def query_insertion_time @query_insertion_time end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
22 23 24 |
# File 'lib/druid_config/entities/task.rb', line 22 def status @status end |
Class Method Details
.find(id) ⇒ Object
Find a task based on id
27 28 29 30 31 32 33 34 35 |
# File 'lib/druid_config/entities/task.rb', line 27 def self.find(id) # Set end point for HTTParty base_uri( "#{DruidConfig.client.overlord}"\ "druid/indexer/#{DruidConfig::Version::API_VERSION}/task") # Get data status = get("/#{id}/status") new(id, status['status']['status']) end |
Instance Method Details
#datasource ⇒ Object
Get the dataSource of this task
85 86 87 |
# File 'lib/druid_config/entities/task.rb', line 85 def datasource payload['dataSource'] end |
#group_id ⇒ Object
Group of the task
92 93 94 |
# File 'lib/druid_config/entities/task.rb', line 92 def group_id payload['groupId'] end |
#log ⇒ Object
Current log of a task
78 79 80 |
# File 'lib/druid_config/entities/task.rb', line 78 def log self.class.get("/#{@id}/log") end |
#payload ⇒ Object
Get payload of the task
71 72 73 |
# File 'lib/druid_config/entities/task.rb', line 71 def payload @payload ||= self.class.get("/#{@id}")['payload'] end |