|
|
@ -7,6 +7,8 @@ from rq import Queue, Worker
|
|
|
|
from redis.exceptions import ConnectionError
|
|
|
|
from redis.exceptions import ConnectionError
|
|
|
|
from rq.scripts import add_standard_arguments
|
|
|
|
from rq.scripts import add_standard_arguments
|
|
|
|
from rq.scripts import setup_redis
|
|
|
|
from rq.scripts import setup_redis
|
|
|
|
|
|
|
|
from rq.scripts import read_config_file
|
|
|
|
|
|
|
|
from rq.scripts import setup_default_arguments
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def format_colors(record, handler):
|
|
|
|
def format_colors(record, handler):
|
|
|
@ -53,12 +55,6 @@ def parse_args():
|
|
|
|
return parser.parse_args()
|
|
|
|
return parser.parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def read_config_file(module):
|
|
|
|
|
|
|
|
"""Reads all UPPERCASE variables defined in the given module file."""
|
|
|
|
|
|
|
|
settings = __import__(module, [], [], [], -1)
|
|
|
|
|
|
|
|
return {k: v for k, v in settings.__dict__.items() if k.upper() == k}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
args = parse_args()
|
|
|
|
args = parse_args()
|
|
|
|
|
|
|
|
|
|
|
@ -69,13 +65,9 @@ def main():
|
|
|
|
if args.config:
|
|
|
|
if args.config:
|
|
|
|
settings = read_config_file(args.config)
|
|
|
|
settings = read_config_file(args.config)
|
|
|
|
|
|
|
|
|
|
|
|
# Default arguments
|
|
|
|
setup_default_arguments(args, settings)
|
|
|
|
if args.host is None:
|
|
|
|
|
|
|
|
args.host = settings.get('REDIS_HOST', 'localhost')
|
|
|
|
# Other default arguments
|
|
|
|
if args.port is None:
|
|
|
|
|
|
|
|
args.port = int(settings.get('REDIS_PORT', 6379))
|
|
|
|
|
|
|
|
if args.db is None:
|
|
|
|
|
|
|
|
args.db = settings.get('REDIS_DB', 0)
|
|
|
|
|
|
|
|
if args.sentry_dsn is None:
|
|
|
|
if args.sentry_dsn is None:
|
|
|
|
args.sentry_dsn = settings.get('SENTRY_DSN', None)
|
|
|
|
args.sentry_dsn = settings.get('SENTRY_DSN', None)
|
|
|
|
|
|
|
|
|
|
|
|