예제 #1
0
__email__ = '*****@*****.**'
__status__ = 'Production'
__license__ = 'MIT'

import sys
import time
import pika
import argparse
import json
from ADSWorker import app
from ADSWorker.pipeline.example import ExampleWorker
from ADSWorker.pipeline import generic
from ADSWorker.pipeline import pstart
from ADSWorker.utils import setup_logging

logger = setup_logging(__file__, __name__)


def purge_queues(queues):
    """
    Purges the queues on the RabbitMQ instance of its content

    :param queues: queue name that needs to be purged
    :return: no return
    """

    publish_worker = generic.RabbitMQWorker()
    publish_worker.connect(app.config.get('RABBITMQ_URL'))

    for worker, wconfig in app.config.get('WORKERS').iteritems():
            for x in ('publish', 'subscribe'):
예제 #2
0
파일: pstart.py 프로젝트: adsabs/ADSWorker
"""


from ADSWorker import app
from ADSWorker.pipeline import generic
from ADSWorker.utils import setup_logging
from copy import deepcopy
import multiprocessing
import os
import signal
import sys
import threading
import time


logger = setup_logging(os.path.abspath(os.path.join(__file__, '..')), __name__)


class Singleton(object):
    """
    Singleton type class. Collates a list of the class instances.
    """

    _instances = {}

    def __call__(cls, *args, **kwargs):  # @NoSelf
        if cls not in cls._instances:
            cls._instances[cls] = \
                super(Singleton, cls).__call__(*args, **kwargs)
        return cls._instances[cls]