Class: Superset::Dashboard::WarmUpCache
- Defined in:
- lib/superset/dashboard/warm_up_cache.rb
Constant Summary
Constants inherited from Request
Instance Attribute Summary collapse
-
#dashboard_id ⇒ Object
readonly
Returns the value of attribute dashboard_id.
Attributes inherited from Request
Instance Method Summary collapse
-
#initialize(dashboard_id:) ⇒ WarmUpCache
constructor
A new instance of WarmUpCache.
- #perform ⇒ Object
- #response ⇒ Object
- #warm_up_dataset(dataset_name, db_name) ⇒ Object
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:) ⇒ WarmUpCache
Returns a new instance of WarmUpCache.
7 8 9 |
# File 'lib/superset/dashboard/warm_up_cache.rb', line 7 def initialize(dashboard_id:) @dashboard_id = dashboard_id end |
Instance Attribute Details
#dashboard_id ⇒ Object (readonly)
Returns the value of attribute dashboard_id.
5 6 7 |
# File 'lib/superset/dashboard/warm_up_cache.rb', line 5 def dashboard_id @dashboard_id end |
Instance Method Details
#perform ⇒ Object
11 12 13 14 |
# File 'lib/superset/dashboard/warm_up_cache.rb', line 11 def perform validate_dashboard_id response end |
#response ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/superset/dashboard/warm_up_cache.rb', line 16 def response dataset_details = fetch_dataset_details(dashboard_id) dataset_details.each do |dataset| begin warm_up_dataset(dataset["datasource_name"], dataset["name"]) rescue => e Rollbar.error("Warm up cache failed for the dashboard #{dashboard_id.to_s} and for the dataset #{dataset["datasource_name"]} - #{e}") end end end |
#warm_up_dataset(dataset_name, db_name) ⇒ Object
27 28 29 |
# File 'lib/superset/dashboard/warm_up_cache.rb', line 27 def warm_up_dataset(dataset_name, db_name) Superset::Dataset::WarmUpCache.new(dashboard_id: dashboard_id, table_name: dataset_name, db_name: db_name).perform end |