本文整理匯總了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 )
示例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." )