コード例 #1
0
class IncrController:
    def __init__(self, configuration = configuration.Configuration()):
        self.config = configuration
        hadoop_client_path = 'hadoop_client/bin'
        self.doneFile =  configuration.doneFile
        self.copyingFile =configuration.copyingFile

        hadoopToolPath = os.path.join(os.path.dirname(__file__),hadoop_client_path)

        self.incr_dirs  = []
        self.pangu_incr_dirs = []
        self.copied_paterns = []

        self.searchSystem=SearchSystem(self.config)

        self.logger = logging.getLogger()


    def printLog(self, info):
        fobj = open(self.eagleLogFile, 'a')
        info = info + ' ' + time.asctime()
        fobj.write(info)
        fobj.write('\n')
        fobj.close
    def run(self):
        self.logger.info('instrease build will start')

        build_cluster = self.searchSystem.buildSearchClusters()
        if build_cluster != error.NO_ERROR and build_cluster != error.ERROR_NO_INCR_DATA:
            # self.printLog('Critical: build Increase data failed')
            self.logger.error('Critical: build Increase data failed')
            return False

        self.logger.info('build Increase completed')
        return True
コード例 #2
0
    def updateService(self):

        self.updateServiceBegin()

        searchSystem = SearchSystem(self.config)
        errorNo = searchSystem.updateSearchClusters()
        
        if errorNo != error.NO_ERROR:
            info = 'Critical - ' + error.getErrorMessage(errorNo)
            self.logger.error(info)
            self.printLog(info)
            return False
        else:
            info = 'OK - success'
            self.printLog(info)

        self.updateServiceEnd() 
        return True
コード例 #3
0
    def __init__(self, configuration = configuration.Configuration()):
        self.config = configuration
        hadoop_client_path = 'hadoop_client/bin'
        self.doneFile =  configuration.doneFile
        self.copyingFile =configuration.copyingFile

        hadoopToolPath = os.path.join(os.path.dirname(__file__),hadoop_client_path)

        self.incr_dirs  = []
        self.pangu_incr_dirs = []
        self.copied_paterns = []

        self.searchSystem=SearchSystem(self.config)

        self.logger = logging.getLogger()