jfrag1 commented on code in PR #23853:
URL: https://github.com/apache/superset/pull/23853#discussion_r1186365772
##########
superset/cachekeys/api.py:
##########
@@ -40,10 +42,98 @@ class CacheRestApi(BaseSupersetModelRestApi):
class_permission_name = "CacheRestApi"
include_route_methods = {
"invalidate",
+ "warm_up_cache",
}
openapi_spec_component_schemas = (CacheInvalidationRequestSchema,)
+ @expose("/warm_up_cache", methods=["GET"])
+ @protect()
+ @safe
+ @statsd_metrics
+ @event_logger.log_this_with_context(
+ action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
+ f".warm_up_cache",
+ log_to_statsd=False,
+ )
+ def warm_up_cache(self) -> Response:
+ """Warms up the cache for the slice or table.
+
+ Note for slices a force refresh occurs.
+
+ In terms of the `extra_filters` these can be obtained from records in
the JSON
+ encoded `logs.json` column associated with the `explore_json` action.
+
+ ---
+ get:
+ description: >-
+ Warms up the cache for the slice or table
+ parameters:
+ - in: query
+ name: slice_id
+ schema:
+ type: integer
+ description: The ID of the chart to warm up cache for
+ - in: query
+ name: dashboard_id
+ schema:
+ type: integer
+ description: The ID of the dashboard to get filters for when
warming cache
+ - in: query
+ name: table_name
+ schema:
+ type: string
+ description: The name of the table to warm up cache for
+ - in: query
+ name: db_name
+ schema:
+ type: string
+ description: The name of the database where the table is located
+ - in: query
+ name: extra_filters
+ schema:
+ type: string
+ description: Extra filters to apply when warming up cache
+ responses:
+ 200:
+ description: Each chart's warmup status
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ result:
+ type: array
+ items:
+ type: object
+ properties:
+ slice_id:
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]