mirror of https://github.com/apache/superset.git
chore: Releasing SQL Lab Celery results (#10279)
Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
parent
3f2f5e8311
commit
4e4ccd48d6
|
@ -2101,7 +2101,7 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
|
||||||
logger.info("Query %i: Running query on a Celery worker", query.id)
|
logger.info("Query %i: Running query on a Celery worker", query.id)
|
||||||
# Ignore the celery future object and the request may time out.
|
# Ignore the celery future object and the request may time out.
|
||||||
try:
|
try:
|
||||||
sql_lab.get_sql_results.delay(
|
task = sql_lab.get_sql_results.delay(
|
||||||
query.id,
|
query.id,
|
||||||
rendered_query,
|
rendered_query,
|
||||||
return_results=False,
|
return_results=False,
|
||||||
|
@ -2111,6 +2111,10 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
|
||||||
expand_data=expand_data,
|
expand_data=expand_data,
|
||||||
log_params=log_params,
|
log_params=log_params,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Explicitly forget the task to ensure the task metadata is removed from the
|
||||||
|
# Celery results backend in a timely manner.
|
||||||
|
task.forget()
|
||||||
except Exception as ex: # pylint: disable=broad-except
|
except Exception as ex: # pylint: disable=broad-except
|
||||||
logger.exception("Query %i: %s", query.id, str(ex))
|
logger.exception("Query %i: %s", query.id, str(ex))
|
||||||
msg = _(
|
msg = _(
|
||||||
|
|
Loading…
Reference in New Issue