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


Python GaussLog.log方法代码示例

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


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

示例1: elif

# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import log [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: GaussLog

# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import log [as 别名]
    # check if user exist and is the right user
    if (g_clusterUser == ""):
        GaussLog.exitWithError("Parameter input error, need '-U' parameter.")     
    PlatformCommand.checkUser(g_clusterUser)
        
    if (confType not in [ConfigInstance.CONFIG_ALL_FILE, ConfigInstance.CONFIG_GS_FILE, ConfigInstance.CONFIG_PG_FILE]):
        GaussLog.exitWithError("Unknown config type: %s" % confType)
        
    if (logFile == ""):
        logFile = DefaultValue.getOMLogPath(DefaultValue.DEFAULT_LOG_FILE, g_clusterUser, "")

    if (alarm_component == ""):
        alarm_component = DefaultValue.ALARM_COMPONENT_PATH

    # Init logger
    global g_logger
    g_logger = GaussLog(logFile, "ConfigInstance")
    try:
        configer = ConfigInstance(cooParams, dataParams, confType, gsPath, alarm_component)
        configer.run()
        
        g_logger.log("Config all instances 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,代码行数:31,代码来源:ConfigInstance.py

示例3: Exception

# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import log [as 别名]
        raise Exception("There is no coordinator to connect!")
    ip = connList[0][0]
    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__':
开发者ID:jianhuiz,项目名称:cf-apps,代码行数:33,代码来源:LockCluster.py

示例4: GaussLog

# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import log [as 别名]
            logFile = value
        else:
            GaussLog.exitWithError("Parameter input error, unknown options %s." % key)

    # check if user exist and is the right user
    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, "")
          
    if (not os.path.isabs(logFile)):
        GaussLog.exitWithError("Parameter input error, log file need absolute path.")

    # Init logger
    global g_logger
    g_logger = GaussLog(logFile, "UpgradeConfig")
    try:    
        upgrader = UpgradeConfiguration()
        upgrader.run()
        
        g_logger.log("Upgrade 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,代码来源:UpgradeConfig.py

示例5: elif

# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import log [as 别名]
        elif (key == "-U"):
            g_clusterUser = value
        elif (key == "-P"):
            dbInitParams.append(value)
        elif (key == "-G"):
            gtmInitParams.append(value)
        elif (key == "-l"):
            logFile = os.path.abspath(value)

    # check if user exist and is the right user
    PlatformCommand.checkUser(g_clusterUser)
        
    if (logFile == ""):
        logFile = DefaultValue.getOMLogPath(DefaultValue.DEFAULT_LOG_FILE, g_clusterUser, "")

    # Init logger
    global g_logger
    g_logger = GaussLog(logFile, "InitInstance")
    try:
        dbInit = initDbNode(dbInitParams, gtmInitParams)
        dbInit.run()
        
        g_logger.log("Init instances 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,代码来源:InitInstance.py

示例6: GaussLog

# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import log [as 别名]
        GaussLog.exitWithError("Parameter input error, need '-U' parameter.")
    PlatformCommand.checkUser(g_clusterUser)

    # check log file
    if (logFile == ""):
        logFile = DefaultValue.getOMLogPath(DefaultValue.DEFAULT_LOG_FILE, g_clusterUser, "")
    if (not os.path.isabs(logFile)):
        GaussLog.exitWithError("Parameter input error, log path need absolute path.")
    
    if (restorePara == False and restoreBin == False):
        GaussLog.exitWithError("Parameter input error, need '-p' or '-b' parameter.")

    if (restoreDir == ""):
        GaussLog.exitWithError("Parameter input error, need '-P' parameter.")
    
    global g_logger
    g_logger = GaussLog(logFile, "LocalRestore")
    g_logger.log("Local restore begin...")
    try:
        LocalRestorer = LocalRestore(g_clusterUser, restoreDir, restorePara, restoreBin)
        LocalRestorer.run()
        
        g_logger.log("Local restore succeed.")
        g_logger.closeLog()
        sys.exit(0)
    except Exception, e:
        GaussLog.exitWithError("Local restore Failed! %s" % str(e))

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


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