本文整理匯總了Python中pxStats.lib.StatsDateLib.StatsDateLib.getStartEndFromCurrentYear方法的典型用法代碼示例。如果您正苦於以下問題:Python StatsDateLib.getStartEndFromCurrentYear方法的具體用法?Python StatsDateLib.getStartEndFromCurrentYear怎麽用?Python StatsDateLib.getStartEndFromCurrentYear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pxStats.lib.StatsDateLib.StatsDateLib
的用法示例。
在下文中一共展示了StatsDateLib.getStartEndFromCurrentYear方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: getOptionsFromParser
# 需要導入模塊: from pxStats.lib.StatsDateLib import StatsDateLib [as 別名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getStartEndFromCurrentYear [as 別名]
#.........這裏部分代碼省略.........
#TODO :fixStartEnd method???
if fixedPrevious :
if daily :
span = "daily"
graphicType = "daily"
start, end = StatsDateLib.getStartEndFromPreviousDay( date )
elif weekly:
span = "weekly"
graphicType = "weekly"
start, end = StatsDateLib.getStartEndFromPreviousWeek( date )
elif monthly:
span = "monthly"
graphicType = "monthly"
start, end = StatsDateLib.getStartEndFromPreviousMonth( date )
elif yearly:
span = "yearly"
graphicType = "yearly"
start, end = StatsDateLib.getStartEndFromPreviousYear( date )
timeSpan = int( StatsDateLib.getSecondsSinceEpoch( end ) - StatsDateLib.getSecondsSinceEpoch( start ) ) / 3600
elif fixedCurrent:
if daily :
span = "daily"
graphicType = "daily"
start, end = StatsDateLib.getStartEndFromCurrentDay( date )
elif weekly:
span = "weekly"
graphicType = "weekly"
start, end = StatsDateLib.getStartEndFromCurrentWeek( date )
elif monthly:
span = "monthly"
graphicType = "monthly"
start, end = StatsDateLib.getStartEndFromCurrentMonth( date )
elif yearly:
span = "yearly"
graphicType = "yearly"
start, end = StatsDateLib.getStartEndFromCurrentYear( date )
timeSpan = int( StatsDateLib.getSecondsSinceEpoch( end ) - StatsDateLib.getSecondsSinceEpoch( start ) ) / 3600
else:
#TODO fix span method???
if daily :
timeSpan = 24
graphicType = "daily"
span = "daily"
elif weekly:
timeSpan = 24 * 7
graphicType = "weekly"
span = "weekly"
elif monthly:
timeSpan = 24 * 30
graphicType = "monthly"
span = "monthly"
elif yearly:
timeSpan = 24 * 365
graphicType = "yearly"
span = "yearly"
start = StatsDateLib.getIsoFromEpoch( StatsDateLib.getSecondsSinceEpoch( date ) - timeSpan*60*60 )
end = date
if fileType != "tx" and fileType != "rx":
print _("Error. File type must be either tx or rx.")
print _('Multiple types are not accepted.' )
print _("Use -h for additional help.")
print _("Program terminated.")
sys.exit()
if includeGroups == True:
configParameters = StatsConfigParameters()
configParameters.getAllParameters()
groups = configParameters.groupParameters.groups
machinesToSearch = machines[:]#Forces a copy and nota reference.
for machine in machines:
if machinesAreClusters == True :
machineConfig = MachineConfigParameters()
machineConfig.getParametersFromMachineConfigurationFile()
machinesAssociatedWith = machineConfig.getMachinesAssociatedWith( machine )
machinesToTest = str(machinesAssociatedWith).replace('[','').replace(']', '').replace(',','').replace( "'",'' ).replace('"','' ).\
replace(" ",'').replace('[','').replace(']', '').replace(',','').replace( "'",'' ).replace('"','' ).replace(" ",'')
for group in groups:
groupsMachine = str( configParameters.groupParameters.groupsMachines[group] ).replace('[','').replace(']', '').\
replace(',','').replace( "'",'' ).replace('"','' ).replace(" ",'')
#print "machinesToTest %s groupsMachine %s" %(machinesToTest,groupsMachine )
if machinesToTest in groupsMachine :
if groupsMachine not in machinesToSearch:
machinesToSearch.append(groupsMachine)
#print machines
infos = _CsvInfos( start = start , end = end , span = span, timeSpan = timeSpan, fileType = fileType, machinesForLabels = machines,\
machinesToSearch = machinesToSearch, machinesAreClusters = machinesAreClusters, dataSource = "databases", outputLanguage = outputLanguage )
return infos