Example #1
0
def main(runOnce):
    logConfig(True)
    config = {}
    config['feedThresholdPercent'] = 50.0
    config['fupThresholdPercent'] = 90.0
    config['configDir'] = '/opt/ems/fast'
    config['fastHome'] = DEFAULT_FAST_HOME
    controller = getController(config)
    controller.loadQueues()
    if len(feedLocs) > 0:
        log('DocAPIQueueSizeController: locations disabled for feed:' + str(feedLocs))
    if len(fupLocs) > 0:
        log('DocAPIQueueSizeController: locations disabled for fup:' + str(fupLocs))
    fcm = FastClusterManager(config['fastHome'])
    while True: 
        fsm = FastStatisticsManager('localhost',8080)
        controller = getController(config)
        controller.run(fcm,fsm,fsm.getStatistics())
        if runOnce:
            break
        else:
            time.sleep(300)
Example #2
0
# 获取参数
options         = getOpt()

url             = options.url
deep            = options.deep
dbfile          = options.dbfile
threadNumber    = options.threadNumber
conNumber    = threadNumber
keyword         = options.key
logfile         = options.logfile
loglevel        = options.loglevel
testself        = options.testself

# 设置日志文件
logConfig(loglevel,logfile)
# 设置连接数,与线程数相同
setPoolNum(conNumber)
# 自测
TT(testself)
# 设置任务
tasks = [ url,]
# 设置数据库存储文件
saver = SaveMethod(dbfile)
# 设置关键字,以及将设置好的数据存储方式saver传递给分析人员
analysis = Analysis(saver, keyword)
# 设置搜索深度
linkm = LinkM(deep)

w = workerFactory(analysis,linkm)
tm = ThreadM(w,max_thread=threadNumber)