当前位置: 首页>>代码示例>>Python>>正文


Python GaussLog.logExit方法代码示例

本文整理汇总了Python中script.util.GaussLog.GaussLog.logExit方法的典型用法代码示例。如果您正苦于以下问题:Python GaussLog.logExit方法的具体用法?Python GaussLog.logExit怎么用?Python GaussLog.logExit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在script.util.GaussLog.GaussLog的用法示例。


在下文中一共展示了GaussLog.logExit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: elif

# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import logExit [as 别名]
        elif (key == "-l"):
            logFile = os.path.abspath(value)
        elif(key == "-i"):
            if (value.isdigit()):
                instanceIds.append(int(value))
            else:
                GaussLog.exitWithError("Parameter invalid. -i %s is not digit." % value)

    # check if user exist and is the right user
    PlatformCommand.checkUser(g_clusterUser)

    #check log dir
    if (logFile == ""):
        logFile = DefaultValue.getOMLogPath(DefaultValue.DEFAULT_LOG_FILE, g_clusterUser, "", "")

    #Init logger
    global g_logger
    g_logger = GaussLog(logFile, "CheckConfig")
    try:
        checker = CheckNodeEnv(cooParams, dataParams, instanceIds)
        checker.run()

        g_logger.log("Check config on node[%s] successfully!" % socket.gethostname())
        g_logger.closeLog()
        sys.exit(0)
    except Exception, e:
        g_logger.logExit(str(e))

if __name__ == '__main__':
    main()
开发者ID:jianhuiz,项目名称:cf-apps,代码行数:32,代码来源:CheckConfig.py

示例2: case

# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import logExit [as 别名]
    port = connList[0][1]
    
    sql = "select case (select pgxc_lock_for_backup()) when true then (select pg_sleep(%d)) end;" % time_out
    cmd = "gsql -h %s -p %d postgres -X -c \"%s\"" % (ip, port, sql)
    cmd = "su - %s -c '%s'" % (user, cmd)
    sqlThread = CommandThread(cmd)
    sqlThread.start()
    time.sleep(5)
    while True:
        td = endTime - datetime.now()
        leftSeconds = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
        if (leftSeconds <= 0):
            if (sqlThread.isAlive()):
                g_logger.log("Timeout!Release the cluster!")
                g_logger.closeLog()
                sys.exit(0)
            
        if (not sqlThread.isAlive()):
            if (sqlThread.cmdStauts != 0):
                g_logger.logExit("Lock cluster failed!Output: %s" % sqlThread.cmdOutput)
            else:
                g_logger.log("Execute SQL finished!Release the cluster!")
                g_logger.closeLog()
                sys.exit(0)
        
        g_logger.log("Thread is still alive!Left seconds[%s]" % leftSeconds)
        time.sleep(10)
        
if __name__ == '__main__':
    main()
开发者ID:jianhuiz,项目名称:cf-apps,代码行数:32,代码来源:LockCluster.py

示例3: usage

# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import logExit [as 别名]
        if (key == "-h" or key == "--help"):
            usage()
            sys.exit(0)
        elif (key == "-U"):
            g_clusterUser = value
        elif (key == "-l"):
            logFile = value

    if(g_clusterUser == ""):
        GaussLog.exitWithError("Parameter input error, need '-U' parameter.")
    PlatformCommand.checkUser(g_clusterUser)
        
    if(logFile == ""):
        logFile = DefaultValue.getOMLogPath(DefaultValue.DEFAULT_LOG_FILE, g_clusterUser, "")

    # Init logger
    global logger
    logger = GaussLog(logFile, "ConfigHba")
    try:
        configer = ConfigHba()
        configer.run()
        
        logger.log("Config all instances on node[%s] successfully!" % socket.gethostname())
        logger.closeLog()
        sys.exit(0)
    except Exception, e:
        logger.logExit(str(e))
                 
if __name__ == '__main__':
    main()
开发者ID:jianhuiz,项目名称:cf-apps,代码行数:32,代码来源:ConfigHba.py

示例4: elif

# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import logExit [as 别名]
        elif (key == "-p"):
            installPath = value.strip()
        elif (key == "-u"):
            user = value.strip()
        elif (key == "-c"):
            localPort = value.strip()
        elif (key == "-l" or key == "--logpath"):
            logFile = value.strip()
        elif (key == "-d" or key == "--detail"):
            detail = True
        else:
            GaussLog.exitWithError("Unknown parameter for GaussStat: %s" % key)
    
    if(not os.path.exists(installPath) or user == "" or localPort == ""):
        usage()
        GaussLog.exitWithError("indispensable paramter missed.")
        
    if(logFile == ""):
        logFile = "%s/om/gaussdb_local.log" % DefaultValue.getUserLogDirWithUser(user)
        
    logger = GaussLog(logFile, "GaussStat")
        
    try:  
        stat = GaussStat(installPath, user, localPort, logger, detail)
        stat.collect()
        stat.outPut()
    except Exception, e:
        logger.logExit("Can't get statistics, reason: %s" % str(e))
        
    logger.closeLog()
开发者ID:jianhuiz,项目名称:cf-apps,代码行数:32,代码来源:GaussStat.py

示例5: Deduplication

# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import logExit [as 别名]
    if(installPath == ""):
        GaussLog.exitWithError("Parameter input error, need '-R' parameter.")
    if(not os.path.exists(installPath)):
        GaussLog.exitWithError("Parameter Invalid. -R %s is not existed." % installPath)
        
    if(logFile == ""):
        logFile = DefaultValue.getOMLogPath(DefaultValue.DEFAULT_LOG_FILE, g_clusterUser, installPath)

    hostname = socket.gethostname()
    if (hostname != nodename):
        GaussLog.exitWithError("The hostname %s is not match to the nodename %s." % (hostname, nodename)) 
        
    Deduplication(instanceIds)
    if (instanceIds == []):
        GaussLog.exitWithError("No specific instances to replace. Replace config finished.", 0)  

    global g_logger
    g_logger = GaussLog(logFile, "ReplaceConfig")
    try:
        replacer = ReplaceConfig(installPath, nodename, instanceIds)
        replacer.run()
        
        g_logger.closeLog()
        sys.exit(0)
    except Exception, e:
        g_logger.logExit("Replace config Failed! Error:%s" % str(e))

if __name__ == '__main__':

    main()
开发者ID:jianhuiz,项目名称:cf-apps,代码行数:32,代码来源:ReplaceConfig.py


注:本文中的script.util.GaussLog.GaussLog.logExit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。