mirror of
https://github.com/valitydev/redash.git
synced 2024-11-06 09:05:17 +00:00
Remove code duplications
This commit is contained in:
parent
6ebfa16740
commit
e4c7844cae
13
manage.py
13
manage.py
@ -1,7 +1,5 @@
|
||||
"""
|
||||
CLI to start the workers.
|
||||
|
||||
TODO: move API server startup here.
|
||||
CLI to manage redash.
|
||||
"""
|
||||
import atfork
|
||||
atfork.monkeypatch_os_fork_functions()
|
||||
@ -10,11 +8,8 @@ atfork.stdlib_fixer.fix_logging_module()
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import urlparse
|
||||
import redis
|
||||
import time
|
||||
import settings
|
||||
import data
|
||||
from redash import settings, data, redis_connection, data_manager
|
||||
|
||||
|
||||
def start_workers(data_manager):
|
||||
@ -48,10 +43,6 @@ if __name__ == '__main__':
|
||||
parser.add_argument("command")
|
||||
args = parser.parse_args()
|
||||
|
||||
url = urlparse.urlparse(settings.REDIS_URL)
|
||||
redis_connection = redis.StrictRedis(host=url.hostname, port=url.port, db=0, password=url.password)
|
||||
data_manager = data.Manager(redis_connection, settings.INTERNAL_DB_CONNECTION_STRING, settings.MAX_CONNECTIONS)
|
||||
|
||||
if args.command == "worker":
|
||||
start_workers(data_manager)
|
||||
else:
|
||||
|
@ -25,9 +25,9 @@ from flask import g, render_template, send_from_directory, make_response, reques
|
||||
from flask.ext.restful import Resource, abort
|
||||
|
||||
import sqlparse
|
||||
import settings
|
||||
from data import utils
|
||||
import data
|
||||
from redash import settings
|
||||
from redash.data import utils
|
||||
from redash import data
|
||||
|
||||
from redash import app, auth, api, redis_connection, data_manager
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user