Remove code duplications

This commit is contained in:
Arik Fraimovich 2014-01-17 11:14:15 +02:00
parent 6ebfa16740
commit e4c7844cae
2 changed files with 5 additions and 14 deletions

View File

@ -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:

View File

@ -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