當前位置: 首頁>>代碼示例>>Python>>正文


Python StatsDateLib.getIsoWithRoundedSeconds方法代碼示例

本文整理匯總了Python中pxStats.lib.StatsDateLib.StatsDateLib.getIsoWithRoundedSeconds方法的典型用法代碼示例。如果您正苦於以下問題:Python StatsDateLib.getIsoWithRoundedSeconds方法的具體用法?Python StatsDateLib.getIsoWithRoundedSeconds怎麽用?Python StatsDateLib.getIsoWithRoundedSeconds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pxStats.lib.StatsDateLib.StatsDateLib的用法示例。


在下文中一共展示了StatsDateLib.getIsoWithRoundedSeconds方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: from pxStats.lib.StatsDateLib import StatsDateLib [as 別名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getIsoWithRoundedSeconds [as 別名]
def main():
    """
        @summary : This program is to be used to backup 
                   rrd databases and their corresponding
                   time of update files. Backing up rrd 
                   databases at various point in time is a
                   recommended paractice in case newly
                   entered data is not valid. 
        
    """
    
    setGlobalLanguageParameters()
    
    currentTime = time.time()        
    currentTime = StatsDateLib.getIsoFromEpoch( currentTime )
    currentTime = StatsDateLib.getIsoWithRoundedSeconds( currentTime )
    currentTime = currentTime.replace(" ", "_")
    
    backupsToKeep = 20
    
    if len( sys.argv ) == 2:
        try:
            backupsToKeep =  int( sys.argv[1] )
        except:
            print _( "Days to keep value must be an integer. For default 20 backups value, type nothing." )
            sys.exit()
                      
    backupDatabaseUpdateTimes( currentTime, backupsToKeep )
    backupDatabases( currentTime, backupsToKeep )
開發者ID:hawkeye438,項目名稱:metpx,代碼行數:31,代碼來源:backupRRDDatabases.py

示例2: main

# 需要導入模塊: from pxStats.lib.StatsDateLib import StatsDateLib [as 別名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getIsoWithRoundedSeconds [as 別名]
def main():
    """
        @summary : This program is to be used to backup rrd databases and their corresponding
                   time of update files. Backing up rrd databases at various point in time is a
                   recommended paractice in case newly entered data is not valid. 
        
    """

    setGlobalLanguageParameters()
    
    timeToRestore = "2006-10-23 09:00:00"
    
    currentTime = time.time()        
    currentTime = StatsDateLib.getIsoFromEpoch( currentTime )
    currentTime = StatsDateLib.getIsoWithRoundedSeconds( currentTime )
    currentTime = currentTime.replace(" ", "_")
    
    generalParameters = StatsConfigParameters()
    
    generalParameters.getAllParameters()
    
    
    if len( sys.argv ) == 2:
        print     sys.argv
        #try:
        timeToRestore =  sys.argv[1]
        t =  time.strptime( timeToRestore, '%Y-%m-%d %H:%M:%S' )#will raise exception if format is wrong.
        split = timeToRestore.split()
        timeToRestore = "%s_%s" %( split[0], split[1] )
        
#         except:
#             print 'Date must be of the following format "YYYY-MM-DD HH:MM:SS"'
#             print "Program terminated."     
#             sys.exit()
                
        restoreDatabaseUpdateTimes( timeToRestore, currentTime, generalParameters.nbDbBackupsToKeep )        
        restoreDatabases( timeToRestore, currentTime, generalParameters.nbDbBackupsToKeep )    
            

    
    else:
        print _( "You must specify a date." )
        print _( "Date must be of the folowing format YYYY-MM-DD HH:MM:SS" )
        print _( "Program terminated." )
開發者ID:hawkeye438,項目名稱:metpx,代碼行數:46,代碼來源:restoreRoundRobinDatabases.py


注:本文中的pxStats.lib.StatsDateLib.StatsDateLib.getIsoWithRoundedSeconds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。