# Path: greenqueue/settings.py
# GREENQUEUE_BIND_ADDRESS = getattr(settings, 'GREENQUEUE_BIND_ADDRESS', 'ipc:///tmp/greenqueue.sock')
# GREENQUEUE_TASK_MODULES = getattr(settings, 'GREENQUEUE_TASK_MODULES', [])
# GREENQUEUE_BACKEND = getattr(settings, 'GREENQUEUE_BACKEND', 'greenqueue.backends.sync.SyncService')
# GREENQUEUE_WORKER_MANAGER = getattr(settings, 'GREENQUEUE_WORKER_MANAGER', 'greenqueue.worker.sync.SyncManager')
# GREENQUEUE_RESULTS_BACKEND = getattr(settings, "GREENQUEUE_RESULTS_BACKEND", "greenqueue.storage.backends.model.StorageBackend")
# GREENQUEUE_IGNORE_RESULT = getattr(settings, "GREENQUEUE_IGNORE_RESULT", True)
# GREENQUEUE_BACKEND_POOLSIZE = getattr(settings, 'GREENQUEUE_BACKEND_POOLSIZE', 2)
# GREENQUEUE_BACKEND_TASKBUFF = getattr(settings, 'GREENQUEUE_BACKEND_TASKBUFF', 5)
# GREENQUEUE_RABBITMQ_USERNAME = getattr(settings, 'GREENQUEUE_RABBITMQ_USERNAME', None)
# GREENQUEUE_RABBITMQ_PASSWORD = getattr(settings, 'GREENQUEUE_RABBITMQ_PASSWORD', None)
# GREENQUEUE_RABBITMQ_HOSTNAME = getattr(settings, 'GREENQUEUE_RABBITMQ_HOSTNAME', 'localhost')
# GREENQUEUE_RABBITMQ_PORT = getattr(settings, 'GREENQUEUE_RABBITMQ_PORT', 5672)
# GREENQUEUE_RABBITMQ_VHOST = getattr(settings, 'GREENQUEUE_RABBITMQ_VHOST', '/')
# GREENQUEUE_RABBITMQ_QUEUE = getattr(settings, 'GREENQUEUE_RABBITMQ_QUEUE', 'greenqueue')
# GREENQUEUE_RABBITMQ_ROUTING_KEY = getattr(settings, 'GREENQUEUE_RABBITMQ_ROUTING_KEY', GREENQUEUE_RABBITMQ_QUEUE)
# GREENQUEUE_RABBITMQ_EXCHANGE = getattr(settings, 'GREENQUEUE_RABBITMQ_EXCHANGE', '')
# 
# Path: greenqueue/shortcuts.py
# def load_backend_class():
#     """
#     Load a default backend class instance."
#     """
#     return load_class(settings.GREENQUEUE_BACKEND)


from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from optparse import make_option
from greenqueue import settings as gq_settings
from greenqueue.shortcuts import load_backend_class
import logging
import zmq
import sys
import os
# -*- coding: utf-8 -*-



log = logging.getLogger('greenqueue')


class Command(BaseCommand):
    option_list = BaseCommand.option_list + (
        make_option('--socket', action="store", dest="socket", default=gq_settings.GREENQUEUE_BIND_ADDRESS,
            help="Tells greenqueue server to use this zmq push socket path instead a default."),
    )

    help = "Starts a greenqueue worker."
    args = "[]"

    def handle(self, *args, **options):

# Path: greenqueue/settings.py
# GREENQUEUE_BIND_ADDRESS = getattr(settings, 'GREENQUEUE_BIND_ADDRESS', 'ipc:///tmp/greenqueue.sock')
# GREENQUEUE_TASK_MODULES = getattr(settings, 'GREENQUEUE_TASK_MODULES', [])
# GREENQUEUE_BACKEND = getattr(settings, 'GREENQUEUE_BACKEND', 'greenqueue.backends.sync.SyncService')
# GREENQUEUE_WORKER_MANAGER = getattr(settings, 'GREENQUEUE_WORKER_MANAGER', 'greenqueue.worker.sync.SyncManager')
# GREENQUEUE_RESULTS_BACKEND = getattr(settings, "GREENQUEUE_RESULTS_BACKEND", "greenqueue.storage.backends.model.StorageBackend")
# GREENQUEUE_IGNORE_RESULT = getattr(settings, "GREENQUEUE_IGNORE_RESULT", True)
# GREENQUEUE_BACKEND_POOLSIZE = getattr(settings, 'GREENQUEUE_BACKEND_POOLSIZE', 2)
# GREENQUEUE_BACKEND_TASKBUFF = getattr(settings, 'GREENQUEUE_BACKEND_TASKBUFF', 5)
# GREENQUEUE_RABBITMQ_USERNAME = getattr(settings, 'GREENQUEUE_RABBITMQ_USERNAME', None)
# GREENQUEUE_RABBITMQ_PASSWORD = getattr(settings, 'GREENQUEUE_RABBITMQ_PASSWORD', None)
# GREENQUEUE_RABBITMQ_HOSTNAME = getattr(settings, 'GREENQUEUE_RABBITMQ_HOSTNAME', 'localhost')
# GREENQUEUE_RABBITMQ_PORT = getattr(settings, 'GREENQUEUE_RABBITMQ_PORT', 5672)
# GREENQUEUE_RABBITMQ_VHOST = getattr(settings, 'GREENQUEUE_RABBITMQ_VHOST', '/')
# GREENQUEUE_RABBITMQ_QUEUE = getattr(settings, 'GREENQUEUE_RABBITMQ_QUEUE', 'greenqueue')
# GREENQUEUE_RABBITMQ_ROUTING_KEY = getattr(settings, 'GREENQUEUE_RABBITMQ_ROUTING_KEY', GREENQUEUE_RABBITMQ_QUEUE)
# GREENQUEUE_RABBITMQ_EXCHANGE = getattr(settings, 'GREENQUEUE_RABBITMQ_EXCHANGE', '')
# 
# Path: greenqueue/shortcuts.py
# def load_backend_class():
#     """
#     Load a default backend class instance."
#     """
#     return load_class(settings.GREENQUEUE_BACKEND)


# Path: greenqueue/management/commands/run_greenqueue.py
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from optparse import make_option
from greenqueue import settings as gq_settings
from greenqueue.shortcuts import load_backend_class
import logging
import zmq
import sys
import os

# -*- coding: utf-8 -*-



log = logging.getLogger('greenqueue')


class Command(BaseCommand):
    option_list = BaseCommand.option_list + (
        make_option('--socket', action="store", dest="socket", default=gq_settings.GREENQUEUE_BIND_ADDRESS,
            help="Tells greenqueue server to use this zmq push socket path instead a default."),
    )

    help = "Starts a greenqueue worker."
    args = "[]"

    def handle(self, *args, **options):

        gq_settings.GREENQUEUE_BIND_ADDRESS = options['socket']