Class: Superset::Dataset::WarmUpCache

Inherits:
Request
  • Object
show all
Defined in:
lib/superset/dataset/warm_up_cache.rb

Constant Summary

Constants inherited from Request

Request::PAGE_SIZE

Instance Attribute Summary collapse

Attributes inherited from Request

#page_num

Instance Method Summary collapse

Methods inherited from Request

call, #query_params, #result, #superset_host

Methods included from Superset::Display

#display_headers, #headings, #list, #list_attributes, #result, #rows, #table, #title

Constructor Details

#initialize(dashboard_id:, table_name:, db_name:) ⇒ WarmUpCache

Returns a new instance of WarmUpCache.



7
8
9
10
11
# File 'lib/superset/dataset/warm_up_cache.rb', line 7

def initialize(dashboard_id:, table_name:, db_name:)
  @dashboard_id = dashboard_id
  @table_name = table_name
  @db_name = db_name
end

Instance Attribute Details

#dashboard_idObject (readonly)

Returns the value of attribute dashboard_id.



5
6
7
# File 'lib/superset/dataset/warm_up_cache.rb', line 5

def dashboard_id
  @dashboard_id
end

#db_nameObject (readonly)

Returns the value of attribute db_name.



5
6
7
# File 'lib/superset/dataset/warm_up_cache.rb', line 5

def db_name
  @db_name
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



5
6
7
# File 'lib/superset/dataset/warm_up_cache.rb', line 5

def table_name
  @table_name
end

Instance Method Details

#params(dashboard_id, table_name, db_name) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/superset/dataset/warm_up_cache.rb', line 22

def params(dashboard_id, table_name, db_name)
  {
    "dashboard_id" => dashboard_id,
    "table_name" => table_name,
    "db_name" => db_name
  }
end

#performObject



13
14
15
# File 'lib/superset/dataset/warm_up_cache.rb', line 13

def perform
  response
end

#responseObject



17
18
19
20
# File 'lib/superset/dataset/warm_up_cache.rb', line 17

def response
  logger.info("Hitting #{route} for warming up the cache for the dashboard #{dashboard_id.to_s} and for the dataset #{table_name}")
  client.put(route, params(dashboard_id, table_name, db_name))
end