From be580b24a55e9312bb34885ccf2461eb4d24f96f Mon Sep 17 00:00:00 2001 From: deecay Date: Wed, 19 Jun 2019 20:41:12 +0900 Subject: [PATCH] Expose celery job timeout setting to env var (#3912) * Expose celery job timeout to env * Change variable name --- redash/metrics/celery.py | 3 ++- redash/settings/__init__.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/redash/metrics/celery.py b/redash/metrics/celery.py index 6b06e3a3a4..64cddc963d 100644 --- a/redash/metrics/celery.py +++ b/redash/metrics/celery.py @@ -3,9 +3,10 @@ import logging import socket import time +from redash import settings from celery.concurrency import asynpool -asynpool.PROC_ALIVE_TIMEOUT = 10.0 +asynpool.PROC_ALIVE_TIMEOUT = settings.CELERY_INIT_TIMEOUT from celery.signals import task_postrun, task_prerun from redash import settings, statsd_client diff --git a/redash/settings/__init__.py b/redash/settings/__init__.py index 21670b6ed0..7e28831091 100644 --- a/redash/settings/__init__.py +++ b/redash/settings/__init__.py @@ -31,6 +31,8 @@ CELERY_RESULT_EXPIRES = int(os.environ.get( "REDASH_CELERY_RESULT_EXPIRES", os.environ.get("REDASH_CELERY_TASK_RESULT_EXPIRES", 3600 * 4))) +CELERY_INIT_TIMEOUT = int(os.environ.get( + "REDASH_CELERY_INIT_TIMEOUT", 10)) CELERY_BROKER_USE_SSL = CELERY_BROKER.startswith('rediss') CELERY_SSL_CONFIG = { 'ssl_cert_reqs': int(os.environ.get("REDASH_CELERY_BROKER_SSL_CERT_REQS", ssl.CERT_OPTIONAL)),