def start(self, nodes): self._nodes = nodes TDDCLogging.info('-->Exception Manager Is Starting.') self._exception_producer = KafkaHelper.make_producer(self._nodes) gevent.spawn(self._send) gevent.sleep() TDDCLogging.info('-->Exception Manager Was Ready.')
def psubscribe(self, pattern): ''' 匹配订阅 ''' ps = self.pubsub() ps.psubscribe(pattern) TDDCLogging.info('--->Pubsub Was Ready.') for item in ps.listen(): yield item ps.unsubscribe('spub') TDDCLogging.info('-->Pubsub Is Exit.')
def __init__(self, nodes, push=True, pull=False): ''' Constructor ''' self._nodes = nodes TDDCLogging.info('-->Storager Manager Is Starting.') self._db = DBManager(self._nodes) if push: gevent.spawn(self._push) gevent.sleep() if pull: gevent.spawn(self._pull) gevent.sleep() TDDCLogging.info('-->Storager Manager Was Ready.')
def start(self, site): self._nodes = site.KAFKA_NODES self._topic = site.EVENT_TOPIC self._group = site.EVENT_TOPIC_GROUP self._events_cls = site.EVENT_TABLES self._cache_manager = EventCacheManager(site) TDDCLogging.info('-->Event Manager Is Starting.') self._event_consumer = KafkaHelper.make_consumer(self._nodes, self._topic, self._group) self._event_queue = gevent.queue.Queue() self._event_call = {} gevent.spawn(self._recv) gevent.sleep() gevent.spawn(self._dispatch) gevent.sleep() TDDCLogging.info('-->Event Manager Was Ready.')
def __init__(self, host_port=None): ''' Constructor params: host_port: EXP: 'localhost:8888' DES: HBase的IP、PORT ''' TDDCLogging.info('---->DB Manager Is Starting.') self._tables = [] host, port = host_port.split(':') self._hb_pool = happybase.ConnectionPool(size=8, host=host, port=int(port), transport='framed', protocol='compact') TDDCLogging.info('----->HBase(%s:%s) Was Ready.' % (host, port)) TDDCLogging.info('---->DB Manager Was Ready.')