コード例 #1
0
ファイル: commandKey.py プロジェクト: cash2one/WebFramework
 def __init__(self, ldap, product, type, key, command, alarmers, logger,
              cubeName, debug, timeInterval):
     self.key = key
     self.timeInterval = timeInterval
     self.command = command
     self.alarmers = alarmers
     self.dbop = DBOperator(ldap, product, type, cubeName, [key], [], [])
     self.logger = logger
     self.cubeName = cubeName
     self.debug = debug
コード例 #2
0
ファイル: downloader.py プロジェクト: lotusharley/mezitu
def startDownloader(lq):
    from dbOperator import DBOperator
    from baseconfig import defaultconfig
    conf = defaultconfig()
    dbo = DBOperator(config=conf)
    while True:
        getSize = conf.DOWNLOADER_QUEUE_SIZE - lq.qsize()
        if getSize > 0:
            urls = dbo.getURL(maxdataLength=conf.DOWNLOADER_QUEUE_SIZE)
            print 'Process #%s Get %s URLS FOR Request' % (str(
                os.getpid()), str(len(urls)))
            for i in urls:
                lq.put(urls)
        else:
            print 'Reach Max Queue Size Wait...'
        time.sleep(15)
コード例 #3
0
ファイル: logFile.py プロジェクト: cash2one/WebFramework
 def __init__(self, ldap, product, type, file, timeInterval, numberKeys,
              stringKeys, statisticTool, wholeFile, keyAlarmers, debug,
              logger, cubeName):
     self.filePattern = file
     self.curFile = file
     self.timePattern = self.parseTimePattern(file)
     self.timeInterval = timeInterval
     self.numberKeys = numberKeys
     self.stringKeys = stringKeys
     self.statisticTool = statisticTool
     self.wholeFile = wholeFile
     self.keyAlarmers = keyAlarmers
     self.dbop = DBOperator(ldap, product, type, cubeName, numberKeys,
                            stringKeys, [])
     self.debug = debug
     self.logger = logger
     self.cubeName = cubeName
     #
     self.position = 0
     self.preFileSize = 0
     self.defaultReadSize = 16 * 1024 * 1024
コード例 #4
0
ファイル: process.py プロジェクト: cash2one/WebFramework
 def __init__(self, ldap, product, type, alias, regPattern, processPath,
              pids, keys, keyAlarmers, logger, cubeName, debug,
              timeInterval):
     self.alias = alias
     self.regPattern = regPattern
     self.processPath = processPath
     self.pids = pids
     self.oldPids = []
     self.keys = keys
     self.keyAlarmers = keyAlarmers
     self.dbop = DBOperator(ldap, product, type, cubeName,
                            self.getDBKeys(alias, keys), [], [])
     self.logger = logger
     self.cubeName = cubeName
     self.debug = debug
     self.timeInterval = timeInterval
     # total mem of machine, unit: mb
     self.totalMem = 0
     self.curUser = None
     self.topN = 12
     # 用于指向获取进程pid的函数
     self.getAllPid = None
     # 若不是直接指定pid, 则每次都调用系统命令, 用于check进程正常 -> 优化: 先尝试用上次的pid, 找不到后再通过regPattern和processPath去更新pid
     self.currentPidCmdPath = []