mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 17:37:19 -05:00
Deprecate old runworkers command.
This commit is contained in:
41
manage.py
41
manage.py
@@ -2,10 +2,7 @@
|
||||
"""
|
||||
CLI to manage redash.
|
||||
"""
|
||||
import signal
|
||||
import logging
|
||||
import time
|
||||
from redash import settings, app, db, models, data_manager, __version__
|
||||
from redash import settings, app, db, models, __version__
|
||||
from redash.import_export import import_manager
|
||||
from flask.ext.script import Manager, prompt_pass
|
||||
|
||||
@@ -22,32 +19,18 @@ def version():
|
||||
|
||||
@manager.command
|
||||
def runworkers():
|
||||
"""Starts the re:dash query executors/workers."""
|
||||
"""Prints deprecation warning."""
|
||||
print "** This command is deprecated. Please use Celery's CLI to control the workers. **"
|
||||
|
||||
def stop_handler(signum, frame):
|
||||
logging.warning("Exiting; waiting for workers")
|
||||
data_manager.stop_workers()
|
||||
exit()
|
||||
|
||||
signal.signal(signal.SIGTERM, stop_handler)
|
||||
signal.signal(signal.SIGINT, stop_handler)
|
||||
|
||||
old_workers = data_manager.redis_connection.smembers('workers')
|
||||
data_manager.redis_connection.delete('workers')
|
||||
|
||||
logging.info("Cleaning old workers: %s", old_workers)
|
||||
|
||||
data_manager.start_workers(settings.WORKERS_COUNT)
|
||||
logging.info("Workers started.")
|
||||
|
||||
while True:
|
||||
try:
|
||||
data_manager.refresh_queries()
|
||||
data_manager.report_status()
|
||||
except Exception as e:
|
||||
logging.error("Something went wrong with refreshing queries...")
|
||||
logging.exception(e)
|
||||
time.sleep(60)
|
||||
# TODO: Move to celery beat?
|
||||
# while True:
|
||||
# try:
|
||||
# data_manager.refresh_queries()
|
||||
# data_manager.report_status()
|
||||
# except Exception as e:
|
||||
# logging.error("Something went wrong with refreshing queries...")
|
||||
# logging.exception(e)
|
||||
# time.sleep(60)
|
||||
|
||||
|
||||
@manager.shell
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
from manager import Manager
|
||||
from worker import Job
|
||||
from manager import Manager, Job
|
||||
|
||||
@@ -40,7 +40,7 @@ def parse_boolean(str):
|
||||
|
||||
NAME = os.environ.get('REDASH_NAME', 're:dash')
|
||||
|
||||
REDIS_URL = os.environ.get('REDASH_REDIS_URL', "redis://localhost:6379")
|
||||
REDIS_URL = os.environ.get('REDASH_REDIS_URL', "redis://localhost:6379/0")
|
||||
|
||||
STATSD_HOST = os.environ.get('REDASH_STATSD_HOST', "127.0.0.1")
|
||||
STATSD_PORT = int(os.environ.get('REDASH_STATSD_PORT', "8125"))
|
||||
|
||||
Reference in New Issue
Block a user