示例#1
0
    def run(self):
        logger.info("thread is started")
        while not self.__stop_flag.is_set():
            if self.__journal.status() in (Journal.JS_NOT_SYNC, Journal.JS_SYNC_FAILED):
                try:
                    self.__journal._synchronize()
                except Exception, err:
                    events_provider.error("journal", "journal synchronization is failed with message: %s" % err)

            for i in xrange(JOURNAL_SYNC_CHECK_TIME):
                if self.__stop_flag.is_set():
                    break
                time.sleep(1)
示例#2
0
    def run(self):
        logger.info('thread is started')
        while not self.__stop_flag.is_set():
            if self.__journal.status() in (Journal.JS_NOT_SYNC,
                                           Journal.JS_SYNC_FAILED):
                try:
                    self.__journal._synchronize()
                except Exception, err:
                    events_provider.error(
                        'journal',
                        'journal synchronization is failed with message: %s' %
                        err)

            for i in xrange(JOURNAL_SYNC_CHECK_TIME):
                if self.__stop_flag.is_set():
                    break
                time.sleep(1)
示例#3
0
    def run(self):
        while True:
            out_streem = data = None
            job = self.queue.get()
            data_block = None
            transaction = None
            seek = None
            try:
                if job == QUIT_JOB or self.stop_flag.is_set():
                    break

                transaction, seek = job

                data_block, _, foreign_name = transaction.get_data_block(
                    seek, noclone=False)
                if not foreign_name:
                    raise Exception('foreign name does not found for seek=%s' %
                                    seek)

                if transaction.is_failed():
                    logger.debug(
                        'Transaction {%s} is failed! Skipping data block downloading...'
                        % transaction.get_id())
                    data_block.remove()
                    continue

                self.fabnet_gateway.get(foreign_name,
                                        transaction.get_replica_count(),
                                        data_block)
                data_block.close()

                self.transactions_manager.update_transaction(transaction.get_id(), seek, \
                            is_failed=False, foreign_name=data_block.get_name())
            except Exception, err:
                events_provider.error('GetWorker',
                                      '%s failed: %s' % (transaction, err))
                logger.traceback_debug()
                try:
                    if transaction and data_block:
                        self.transactions_manager.update_transaction(transaction.get_id(), seek, \
                                    is_failed=True, foreign_name=data_block.get_name())

                        data_block.remove()
                except Exception, err:
                    logger.error('[GetWorker.__on_error] %s' % err)
                    logger.traceback_debug()
    def run(self):
        while True:
            out_streem = data = None
            job = self.queue.get()
            data_block = None
            transaction = None
            seek = None
            try:
                if job == QUIT_JOB or self.stop_flag.is_set():
                    break

                transaction, seek = job

                data_block,_,foreign_name = transaction.get_data_block(seek, noclone=False)
                if not foreign_name:
                    raise Exception('foreign name does not found for seek=%s'%seek)

                if transaction.is_failed():
                    logger.debug('Transaction {%s} is failed! Skipping data block downloading...'%transaction.get_id())
                    data_block.remove()
                    continue

                self.fabnet_gateway.get(foreign_name, transaction.get_replica_count(), data_block)
                data_block.close()

                self.transactions_manager.update_transaction(transaction.get_id(), seek, \
                            is_failed=False, foreign_name=data_block.get_name())
            except Exception, err:
                events_provider.error('GetWorker','%s failed: %s'%(transaction, err))
                logger.traceback_debug()            
                try:
                    if transaction and data_block:
                        self.transactions_manager.update_transaction(transaction.get_id(), seek, \
                                    is_failed=True, foreign_name=data_block.get_name())

                        data_block.remove()
                except Exception, err:
                    logger.error('[GetWorker.__on_error] %s'%err)
                    logger.traceback_debug()