def work(self):
     pid = os.getpid()
     log_file = os.path.join(AppConfig.get_log_dir(),
                             'developer_consumer_%d.log' % pid)
     developer_consumer = DeveloperConsumer(log_file,
                                            'developer_consumer_%d' % pid)
     developer_consumer.start()
 def work(self):
     pid = os.getpid()
     log_file = os.path.join(AppConfig.get_log_dir(),
                             'similar_consumer_%d.log' % pid)
     similar_consumer = SimilarConsumer(log_file,
                                        'similar_consumer_%d' % pid)
     similar_consumer.start()
 def work(self):
     pid = os.getpid()
     log_file = os.path.join(AppConfig.get_log_dir(),
                             'category_consumer_%d.log' % pid)
     category_consumer = CategoryConsumer(log_file,
                                          'category_consumer_%d' % pid)
     category_consumer.start()
示例#4
0
project_dir = os.path.join(os.path.dirname(__file__), '..', '..')
project_dir = os.path.normpath(project_dir)
sys.path.insert(1, project_dir)

import time
from pika.exceptions import ConnectionClosed

from common.config import AppConfig
from common.logger import Logger
from rabbitmq.rabbit_topic import RabbitTopic
from common import util
from common.util import UN_PUBLISHED, PUBLISHED
from common.mysql_db_util import MySQLDBUtil


LOG_FILE = os.path.join(AppConfig.get_log_dir(), 'category_producer.log')
LOG_NAME = 'category_producer'
EXCHANGE_NAME = 'category'
QUEUE_NAME = 'category_queue'
ROUTING_KEY = 'category.query'
QUEUE_LIMIT = 10
PRODUCE_WAIT_TIME = 3 * 60


class CategoryProducer:
    def __init__(self):
        self.logger = Logger(LOG_FILE, LOG_NAME, 10*1024*1024, 2)
        self._db_conn = None

    def start(self):
        rabbit_topic = RabbitTopic.init_rabbitmq_producer(EXCHANGE_NAME, self.logger)
示例#5
0
project_dir = os.path.normpath(project_dir)
sys.path.insert(1, project_dir)

import time
from pika.exceptions import ConnectionClosed

from common.config import AppConfig
from common.logger import Logger
from rabbitmq.rabbit_topic import RabbitTopic
from common import util
from common.util import UN_PUBLISHED, PUBLISHED

from common.mysql_db_util import MySQLDBUtil


LOG_FILE = os.path.join(AppConfig.get_log_dir(), 'app_producer.log')
LOG_NAME = 'app_producer'
EXCHANGE_NAME = 'app'
QUEUE_NAME = 'app_queue'
ROUTING_KEY = 'app.crawl'
QUEUE_LIMIT = 50
PRODUCE_WAIT_TIME = 3 * 60


class AppProducer:
    def __init__(self):
        self.logger = Logger(LOG_FILE, LOG_NAME, 10*1024*1024, 2)
        self._db_conn = None

    def start(self):
        rabbit_topic = RabbitTopic.init_rabbitmq_producer(EXCHANGE_NAME, self.logger)
    def __init__(self):
        log_file = os.path.join(AppConfig.get_log_dir(),
                                'google_play_crawler.log')

        self.logger = Logger(log_file, 'google_play_crawler', 10 * 1024 * 1024,
                             2)
示例#7
0
from controllers import IssueController, OrganisationController
from common.config import AppConfig
from connectors.github import GitHubConnector

import parsers

import argparse, logging, sys

cfg = AppConfig()
ghc = GitHubConnector(cfg.get_api_key(), cfg.get_repo(),
                      cfg.get_organisation())
issue_ctrl = IssueController(ghc)
org_ctrl = OrganisationController(ghc)


def setup_logger():
    """Sets up the logger"""
    logging.basicConfig(filename='log.log', level=logging.DEBUG)

    console = logging.StreamHandler()
    console.setLevel(logging.WARNING)
    formatter = logging.Formatter('[%(levelname)s] %(message)s')
    console.setFormatter(formatter)
    logging.getLogger('').addHandler(console)


def setup_argparse():
    """Sets up argparse"""
    parser = argparse.ArgumentParser(
        description='useful command line tools for GitHub')
    subparsers = parser.add_subparsers(dest='group',
示例#8
0
project_dir = os.path.join(os.path.dirname(__file__), '..', '..')
project_dir = os.path.normpath(project_dir)
sys.path.insert(1, project_dir)
print project_dir

import time
from pika.exceptions import ConnectionClosed

from common.config import AppConfig
from common.logger import Logger
from rabbitmq.rabbit_topic import RabbitTopic
from common import util
from common.util import UN_PUBLISHED, PUBLISHED
from common.mysql_db_util import MySQLDBUtil

LOG_FILE = os.path.join(AppConfig.get_log_dir(), 'developer_producer.log')
LOG_NAME = 'developer_producer'
EXCHANGE_NAME = 'developer'
QUEUE_NAME = 'developer_queue'
ROUTING_KEY = 'developer.query'
QUEUE_LIMIT = 10
PRODUCE_WAIT_TIME = 3 * 60


class DeveloperProducer:
    def __init__(self):
        self.logger = Logger(LOG_FILE, LOG_NAME, 10 * 1024 * 1024, 2)
        self._db_conn = None

    def start(self):
        rabbit_topic = RabbitTopic.init_rabbitmq_producer(
示例#9
0
# from common.logger import Logger
from common.const import Const
from common.config import AppConfig
import logging

# 初始化日志实例
logging.basicConfig()
logger = logging.getLogger('AutoTest')
logger.setLevel(logging.INFO)

const = Const()
appconfig = AppConfig()

print(appconfig)
 def work(self):
     pid = os.getpid()
     log_file = os.path.join(AppConfig.get_log_dir(), 'key_word_consumer_%d.log' % pid)
     key_word_consumer = KeyWordConsumer(log_file, 'key_word_consumer_%d' % pid)
     key_word_consumer.start()