Skip to content

Commit

Permalink
Add additional Celery config options (getredash#3961)
Browse files Browse the repository at this point in the history
  • Loading branch information
arikfr authored and harveyrendell committed Nov 14, 2019
1 parent 1e7f8c3 commit ab1f746
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions redash/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
'ssl_keyfile': os.environ.get("REDASH_CELERY_BROKER_SSL_KEYFILE"),
} if CELERY_BROKER_USE_SSL else None

CELERY_WORKER_PREFETCH_MULTIPLIER = int(os.environ.get("REDASH_CELERY_WORKER_PREFETCH_MULTIPLIER", 1))
CELERY_ACCEPT_CONTENT = os.environ.get("REDASH_CELERY_ACCEPT_CONTENT", "json").split(",")
CELERY_TASK_SERIALIZER = os.environ.get("REDASH_CELERY_TASK_SERIALIZER", "json")
CELERY_RESULT_SERIALIZER = os.environ.get("REDASH_CELERY_RESULT_SERIALIZER", "json")

# The following enables periodic job (every 5 minutes) of removing unused query results.
QUERY_RESULTS_CLEANUP_ENABLED = parse_boolean(os.environ.get("REDASH_QUERY_RESULTS_CLEANUP_ENABLED", "true"))
QUERY_RESULTS_CLEANUP_COUNT = int(os.environ.get("REDASH_QUERY_RESULTS_CLEANUP_COUNT", "100"))
Expand Down
7 changes: 5 additions & 2 deletions redash/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@
timezone='UTC',
result_expires=settings.CELERY_RESULT_EXPIRES,
worker_log_format=settings.CELERYD_WORKER_LOG_FORMAT,
worker_task_log_format=settings.CELERYD_WORKER_TASK_LOG_FORMAT)

worker_task_log_format=settings.CELERYD_WORKER_TASK_LOG_FORMAT,
worker_prefetch_multiplier=settings.CELERY_WORKER_PREFETCH_MULTIPLIER,
accept_content=settings.CELERY_ACCEPT_CONTENT,
task_serializer=settings.CELERY_TASK_SERIALIZER,
result_serializer=settings.CELERY_RESULT_SERIALIZER)

# Create a new Task base class, that pushes a new Flask app context to allow DB connections if needed.
TaskBase = celery.Task
Expand Down

0 comments on commit ab1f746

Please sign in to comment.