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


Python StatsDateLib.getSecondsSinceEpoch方法代码示例

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


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

示例1: getThreeClosestDatabasesBackups

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
def getThreeClosestDatabasesBackups( infos ):
    """
        @summary : Returns the three databases backups
                  that are the closest to the startTime 
                  asked for the database recollection.
                  
        @param infos :
        
        @return: the three databases backups
                 that are the closest to the startTime 
                 asked for the database recollection.          
    """
    
    closestFiles = []
    differenceFileTuples = []
    files = os.listdir( StatsPaths.STATSDB + 'databasesTimeOfUpdatesBackups/' )
    
    startTimeInEpochformat = StatsDateLib.getSecondsSinceEpoch( infos.databasesRecollectionStartTime )
    
    for file in files:
        #try:
        
        fileDateInIsoFormat = "%s %s" %(str(file).split("_")[0], str(file).split("_")[1] ) 
        
        tupleToAdd = ( abs( StatsDateLib.getSecondsSinceEpoch(fileDateInIsoFormat) - startTimeInEpochformat ), file )
        
        differenceFileTuples.append( tupleToAdd )     
        

    
    for tuple in differenceFileTuples [:3] :
        closestFiles.append( tuple[1] )
        
    return closestFiles
开发者ID:hawkeye438,项目名称:metpx,代码行数:36,代码来源:recollectData.py

示例2: prepareQuery

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
    def prepareQuery(self):
        """
            @summary : Buildup the query  to be executed.
        
            @SIDE_EFFECT :  modifies self.query value.
            
        """
        
        global _ 
        
        if self.queryParameters.combine == 'true':
            totals = True
            mergerType = "regular"
        else:
            totals = False      
            mergerType = ""
            
            
        fixedCurrent  = False
        fixedPrevious = False
        
        if _("current")  in str(self.queryParameters.fixedSpan).lower() :
            fixedCurrent = True 
        elif _("previous") in str(self.queryParameters.fixedSpan).lower():
            fixedPrevious = True      
        else:
            fixedCurrent  = False
            fixedPrevious = False 
       

            
        hour      = self.queryParameters.endTime.split(" ")[1]
        splitDate = self.queryParameters.endTime.split(" ")[0].split( '-' )
        
        date =  splitDate[2] + '-' + splitDate[1]  + '-' + splitDate[0]  + " " + hour 
        if self.queryParameters.span == "": 
            timespan = 0 
        else:
            timespan = int(self.queryParameters.span )    
            
        StatsDateLib.setLanguage( self.querierLanguage )
        startTime, endTime = StatsDateLib.getStartEndInIsoFormat(date, timespan, self.queryParameters.specificSpan, fixedCurrent, fixedPrevious )
        
        timespan = int( StatsDateLib.getSecondsSinceEpoch( endTime ) - StatsDateLib.getSecondsSinceEpoch( startTime ) ) / 3600   
        
        combinedMachineName = ""
        for machine in self.queryParameters.machines:
            combinedMachineName = combinedMachineName + machine

        machines = [ combinedMachineName ]
       
        
        self.graphicProducer = RRDGraphicProducer( self.queryParameters.fileTypes[0], self.queryParameters.statsTypes ,\
                                                   totals,  self.queryParameters.specificSpan,\
                                                   self.queryParameters.sourLients, timespan,\
                                                   startTime, endTime, machines, False,
                                                   mergerType, True, self.querierLanguage, self.querierLanguage )
  
        StatsDateLib.setLanguage( LanguageTools.getMainApplicationLanguage() )
开发者ID:hawkeye438,项目名称:metpx,代码行数:61,代码来源:RRDQueryBroker.py

示例3: mergePicklesFromDifferentHours

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
 def mergePicklesFromDifferentHours( logger = None , startTime = "2006-07-31 13:00:00",\
                                     endTime = "2006-07-31 19:00:00", client = "satnet",\
                                     machine = "pdsPM", fileType = "tx" ):
     """
         @summary : This method merges entire hourly pickles files together. 
         
         @None    : This does not support merging part of the data of pickles.   
     
     """
     
     if logger != None :
         logger.debug( _("Call to mergeHourlyPickles received.") )
         logging = True
     else:
         logging = False
             
     pickles = []
     entries = {}
     width = StatsDateLib.getSecondsSinceEpoch( endTime ) - StatsDateLib.getSecondsSinceEpoch( startTime )
     startTime = StatsDateLib.getIsoWithRoundedHours( startTime )
     
     seperators = [startTime]
     seperators.extend( StatsDateLib.getSeparatorsWithStartTime( startTime = startTime , width=width, interval=60*StatsDateLib.MINUTE )[:-1])
         
     for seperator in seperators :
         pickles.append( StatsPickler.buildThisHoursFileName(  client = client, offset = 0, currentTime = seperator, machine = machine, fileType = fileType ) )        
     
     
     startingNumberOfEntries = 0
     #print "prior to loading and merging pickles : %s " %( StatsDateLib.getIsoFromEpoch( time.time() ) ) 
     for pickle in pickles : 
         
         if os.path.isfile( pickle ) :
             
                 
             tempCollection = CpickleWrapper.load( pickle )
             if tempCollection != None :
                 for i in xrange( len( tempCollection.fileEntries )  ):
                     entries[startingNumberOfEntries + i] = tempCollection.fileEntries[i]
                 startingNumberOfEntries = startingNumberOfEntries + len( tempCollection.fileEntries ) 
             else:                    
                 sys.exit()
         else:
                        
             emptyEntries =  PickleMerging.fillWithEmptyEntries( nbEmptyEntries = 60, entries = {} )
             for i in xrange( 60 ):
                 entries[i + startingNumberOfEntries ] = emptyEntries [i]
             startingNumberOfEntries = startingNumberOfEntries + 60
     
     #print "after the  loading and merging og pickles : %s " %( StatsDateLib.getIsoFromEpoch( time.time() ) )        
     
     statsCollection = FileStatsCollector(  startTime = startTime , endTime = endTime, interval = StatsDateLib.MINUTE, totalWidth = width, fileEntries = entries,fileType= fileType, logger = logger, logging = logging )
        
             
     return statsCollection        
开发者ID:hawkeye438,项目名称:metpx,代码行数:57,代码来源:PickleMerging.py

示例4: getSeperatorsForHourlyTreatments

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
 def getSeperatorsForHourlyTreatments( startTime, endTime, currentFreeMemory, fileSizesPerHour, usage= "rrd"  ):    
     """
     
         @summary : returns a list of time seperators based on a list of file and 
                    the current amount of free memory. Each seperator represents the time 
                    associated with a certain hourly file. Each seperator will represent
                    the maximum amount of files that can be treated at the same time 
                    without busting the current memory. 
         
         @attention: List fo files MUST refer to hourly files. 
         
         @param startTime: Startime in iso format of the interval to work with.
         @param endTime: End time in iso format of the interval to work with.
         @param currentFreeMemory: Maximum amout of memory to use per seperation.
         @param fileSizesPerHour: size of the file(s) to be treated at every hour.
         
         @return: Returns the time seperators. 
                
     """
     
     currentTotalFileSizes = 0 
     currentTime = StatsDateLib.getSecondsSinceEpoch(startTime)
     seperators = [startTime]         
     
     if fileSizesPerHour[0] < currentFreeMemory:              
         
         for fileSizePerHour in fileSizesPerHour :
             currentTotalFileSizes = currentTotalFileSizes + fileSizePerHour
             
             if currentFreeMemory < currentTotalFileSizes:
                 seperators.append( StatsDateLib.getIsoFromEpoch(currentTime))
                 currentTotalFileSizes = 0
 
                 
             currentTime = currentTime + StatsDateLib.HOUR
     else:
         raise Exception( "Cannot build seperators. First file will not even fit within current available memory." )
         
     if seperators[len(seperators) -1 ] !=  endTime :
         seperators.append( endTime )
                 
     if len(seperators) > 2 : #If any "in between seperators were added"
         i = 1
         currentLength = len(seperators) -1
         while i < currentLength: #add 1 minute 
             if usage == "rrd":
                 seperators.insert(i+1, StatsDateLib.getIsoFromEpoch( (StatsDateLib.getSecondsSinceEpoch(seperators[i]) + StatsDateLib.MINUTE)))
             else:
                 seperators.insert( i+1, StatsDateLib.getSecondsSinceEpoch(seperators[i]) )
             currentLength = currentLength + 1
             i = i + 2
                     
     return seperators    
开发者ID:hawkeye438,项目名称:metpx,代码行数:55,代码来源:MemoryManagement.py

示例5: setMonths

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
 def setMonths( self ):
     """
         @Summary : Sets the months value to an array containing
                    the last X months in "since epoch" numbers
                    based on the globally set NB_MONTHS_DISPLAYED
                   value.
     
     """
     
     currentTime = time.time()
     currentTime = StatsDateLib.getIsoFromEpoch( currentTime )
     currentDate = datetime.date( int(currentTime[0:4]), int(currentTime[5:7]), 1 )  # day always  = 1 in case currentDate.day > 28 
        
     months = []   
         
     for i in range(0,NB_MONTHS_DISPLAYED):
         
         if currentDate.month - (i%12) < 1 :            
             month = currentDate.month - (i%12)+12 
         
         if  currentDate.month -i < 1:
             year  = currentDate.year - int( abs(math.floor( float( ( currentDate.month - i  ) / 12 ) ) ) ) 
         
         else :                 
             month = currentDate.month - i             
             year = currentDate.year                      
          
         months.append( StatsDateLib.getSecondsSinceEpoch( "%s-%s-%s 00:00:00" %(year,month,"01") ) )
             
     months.reverse()
         
     self.months =  months
     print months
开发者ID:hawkeye438,项目名称:metpx,代码行数:35,代码来源:MonthlyGraphicsWebPageGenerator.py

示例6: setMonths

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
 def setMonths( self ):
     """
         Returns the 3 months including current month.
     
     """
     
     currentTime = time.time()
     currentTime = StatsDateLib.getIsoFromEpoch( currentTime )
     currentDate = datetime.date( int(currentTime[0:4]), int(currentTime[5:7]), 1 )     
        
     months = []
     
        
     for i in range(0,5):
         
         if currentDate.month -i < 1 :
             month = currentDate.month -i + 12
             year  = currentDate.year -i 
         else :     
             month = currentDate.month -i 
             year = currentDate.year
             
        
         newdate = StatsDateLib.getSecondsSinceEpoch( "%s-%s-01 00:00:00" %( year,month ) ) 
         months.append( newdate )
         #print year,month,day
     
     months.reverse()
         
     self.months = months
开发者ID:hawkeye438,项目名称:metpx,代码行数:32,代码来源:TotalsGraphicsWebPagesGenerator.py

示例7: getTimeSeperatorsBasedOnAvailableMemory

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
def getTimeSeperatorsBasedOnAvailableMemory( startTime, endTime, clients, fileType, machines ):
    """    
        @summary: returns the time seperators to be used for the transfer 
                  in a way that should prevent overloading memory. 
        
        @param startTime: start time  of the transfer to be attempted.
        @param endTime:   end time of the transfer to be attempted.
        @param clients:   lists of clients/sources to be transferred.
        @param fileType:  tx or rx.
        @param machines:  machines on wich the clients/sources reside.
        
        @return: the time seperators.
        
    """
    
    width = 0        # Width in seconds of the transfer to be attempted
    seperators = []  # Time sperators representing every hour to be transferred.
    allFiles =[]     # List of all pickle files that will be involved
    hourlyFiles = [] # List of all files to be handled for a certain hour.
    hourlyFileSizes = [] # Total file size of all the files to be handled at a certain hour.  
    
    
    totalSizeToloadInMemory = 0.0  # Total size of all the pickle files to load in memory
    currentlyAvailableMemory = 0.0 # Total currently available memory on the present machine.
    seperatorsBasedOnAvailableMemory = [startTime, endTime] # Suppose we have all the momory we need.    

    width = ( StatsDateLib.getSecondsSinceEpoch( endTime ) -  StatsDateLib.getSecondsSinceEpoch( startTime ) ) / StatsDateLib.HOUR    
    
    seperators = [ startTime ]
    seperators.extend( StatsDateLib.getSeparatorsWithStartTime( startTime =  startTime , width= width*StatsDateLib.HOUR, interval=StatsDateLib.HOUR )[:-1])
    
    for seperator in seperators:      
        hourlyFiles = PickleMerging.createNonMergedPicklesList( seperator, machines, fileType, clients )
        allFiles.extend( hourlyFiles )        
        hourlyFileSizes.append( MemoryManagement.getTotalSizeListOfFiles( hourlyFiles )    )
    
    
    totalSizeToloadInMemory = MemoryManagement.getTotalSizeListOfFiles( allFiles )
    currentlyAvailableMemory = MemoryManagement.getCurrentFreeMemory( marginOfError = 0.75 )#never expect more than 25% of the avaiable memory to be avaiable for pickle loading.    
    
    if totalSizeToloadInMemory >= currentlyAvailableMemory:
        seperatorsBasedOnAvailableMemory = MemoryManagement.getSeperatorsForHourlyTreatments( startTime, endTime, currentlyAvailableMemory, hourlyFileSizes  )
          
    return seperatorsBasedOnAvailableMemory
开发者ID:hawkeye438,项目名称:metpx,代码行数:46,代码来源:transferPickleToRRD.py

示例8: isFirstUpdateOfTheWeek

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
 def isFirstUpdateOfTheWeek( self, timeOfUpdateInIsoFormat = "" ): 
     """
         @summary : Returns whether or not an update executed at 
                    timeOfUpdateInIsoFormat would be the first update 
                    of the week.
                    
         @timeOfUpdateInIsoFormat : Time at which the update would be executed.
         
         @return : True or False.
                     
     """
     
     isFirstUpdateOfTheWeek = False
     
     lastUpdateISO = self.getTimeOfLastUpdateInLogs()
     
     if timeOfUpdateInIsoFormat == "" :
         timeOfUpdateInIsoFormat = StatsDateLib.getCurrentTimeInIsoformat()
         
     if timeOfUpdateInIsoFormat >  lastUpdateISO :
         lastUpdateDT    = datetime( int( lastUpdateISO.split("-")[0]),\
                                     int( lastUpdateISO.split("-")[1]),\
                                     int( lastUpdateISO.split("-")[1].split(" ")[0] )\
                                    )
    
         currentUpdateDT = datetime( int( timeOfUpdateInIsoFormat.split("-")[0]),\
                                     int( timeOfUpdateInIsoFormat.split("-")[1]),\
                                     int( timeOfUpdateInIsoFormat.split("-")[1].split(" ")[0] )\
                                    )
         
         weekNumberOfLastUpdate    = time.strftime( '%W', time.gmtime( StatsDateLib.getSecondsSinceEpoch( lastUpdateISO ) ) )
         weekNumberOfCurrentUpdate = time.strftime( '%W', time.gmtime( StatsDateLib.getSecondsSinceEpoch( timeOfUpdateInIsoFormat ) ) )
         
         timeBetweenBothDates = currentUpdateDT - lastUpdateDT
         daysBetween = timeBetweenBothDates.days
         
         if daysBetween < 7 and ( weekNumberOfLastUpdate == weekNumberOfCurrentUpdate ):  #<7 days prevents same week but from different years.
             isFirstUpdateOfTheWeek = False
         else:
             isFirstUpdateOfTheWeek = True    
             
     
     return isFirstUpdateOfTheWeek
开发者ID:hawkeye438,项目名称:metpx,代码行数:45,代码来源:AutomaticUpdatesManager.py

示例9: buildCsvFileName

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
def buildCsvFileName( infos ):
    """ 
    
        @summary: Builds and returns the file name to use for the csv file.
        
        @param infos: _CvsInfos instance containing the required 
                      information to build up the file name.
        
        @return: Return the built up file name.              
                      
    """
    
    global _ 
    
    StatsDateLib.setLanguage(infos.outputLanguage)
    paths = StatsPaths()
    paths.setPaths( infos.outputLanguage )
    
    machinesStr = str(infos.machinesForLabels).replace('[','').replace( ']','' ).replace(',', '').replace("'","").replace( '"','').replace( ' ','' )
    
    currentYear, currentMonth, currentDay = StatsDateLib.getYearMonthDayInStrfTime( StatsDateLib.getSecondsSinceEpoch (infos.start) )     
    currentWeek = time.strftime( "%W", time.gmtime( StatsDateLib.getSecondsSinceEpoch (infos.start) ) )
    
    
    fileName = paths.STATSCSVFILES
   
    if infos.span == "daily":
        fileName = fileName + "/" + _("daily/") + infos.fileType + "/%s/%s/%s/%s.csv" %( machinesStr, currentYear, currentMonth, currentDay )   
    
    elif infos.span == "weekly":
        fileName = fileName + "/" +  _("weekly/") + infos.fileType  + "/%s/%s/%s.csv" %( machinesStr, currentYear, currentWeek ) 
    
    elif infos.span == "monthly":
        fileName = fileName + "/" + _("monthly/") + infos.fileType + "/%s/%s/%s.csv" %( machinesStr, currentYear, currentMonth )
    
    elif infos.span == "yearly":
        fileName = fileName + "/" + _("yearly/") + infos.fileType  + "/%s/%s.csv" %( machinesStr, currentYear )
        
    
    StatsDateLib.setLanguage( LanguageTools.getMainApplicationLanguage() )    
        
    return fileName 
开发者ID:hawkeye438,项目名称:metpx,代码行数:44,代码来源:csvDataConversion.py

示例10: getTimeSinceLastUpdate

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
 def getTimeSinceLastUpdate(self, currentTimeInIsoFormat = "" ):
     """
         @summary : returns the number of seconds between the last update
                    and the currentTime  
     
         @param  currentTimeInIsoFormat: Current time specified in the ISO 
                                         format
                                         
         @return :  the number of seconds between the last update
                    and the currentTime                               
     """
     
     timeBetweenUpdates = 0 
     
     if currentTimeInIsoFormat == "":
         currentTimeInIsoFormat = StatsDateLib.getCurrentTimeInIsoformat()
    
     currentTimeInSSEFormat = StatsDateLib.getSecondsSinceEpoch( currentTimeInIsoFormat )   
     lastUpdateInSSEFormat  =  StatsDateLib.getSecondsSinceEpoch( self.getTimeOfLastUpdateInLogs() )
     
     if currentTimeInSSEFormat > lastUpdateInSSEFormat :
         timeBetweenUpdates = currentTimeInSSEFormat - lastUpdateInSSEFormat
     
     return timeBetweenUpdates
开发者ID:hawkeye438,项目名称:metpx,代码行数:26,代码来源:AutomaticUpdatesManager.py

示例11: buildThisHoursFileName

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
 def buildThisHoursFileName(  client = "someclient", offset = 0, currentTime = "", fileType = "tx", machine = "someMachineName" ):
     """ 
         @summary : Builds a filename using current currentTime.
         
         @Note : The format will be something like this :
                 StatsPaths.STATSPICKLES/clientName/date/TXorRX//machine_hour
                 Ex : StatsPaths.STATSPICKLES/clientName/20060707/tx/machinex_12:00:00
         
                 offset can be used to find a file from an hour close to the current one 
         
                 tempcurrentTime can also be used to build a filename from another hour. 
         
         
         @warning :To be used only with pickles created hourly.
             
     """    
     
     timeFolder = ""
            
     if currentTime == "":
         currentTime = time.time()
     else:
         currentTime = StatsDateLib.getSecondsSinceEpoch( currentTime )    
     
     currentTime = currentTime + ( offset * StatsDateLib.HOUR )
     splitTime = time.gmtime( currentTime )    
             
     for i in range( 3 ):
         
         if int( splitTime[i] ) < 10 :
             timeFolder = timeFolder + "0" + str( splitTime[i] )
         else:
             timeFolder = timeFolder + str( splitTime[i] )          
     
             
     hour = StatsDateLib.getHoursFromIso( StatsDateLib.getIsoFromEpoch( currentTime ) )
     
     maxLt = ( os.statvfs( STATSPATHS.STATSPICKLES )[statvfs.F_NAMEMAX])
     
     fileName = ( "%s" + "%." +  str( maxLt ) + "s/%s/%s/%." + str( maxLt ) + "s_%s" )   %( STATSPATHS.STATSPICKLES, client, timeFolder,  fileType, str(machine),  str(hour) )  
             
     return fileName 
开发者ID:hawkeye438,项目名称:metpx,代码行数:44,代码来源:StatsPickler.py

示例12: setYears

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
 def setYears( self ):
     """
         Returns the last 3 year numbers including the current year.
     
     """
     
     currentTime = time.time()
     currentTime = StatsDateLib.getIsoFromEpoch( currentTime )
     currentDate = datetime.date( int(currentTime[0:4]), int(currentTime[5:7]), 1 )     
     
     years = []    
 
     for i in range(0,3):
         year = currentDate.year - i
         newDate = StatsDateLib.getSecondsSinceEpoch( "%s-%s-%s 00:00:00" %(year, currentDate.month, currentDate.day) )
         years.append(  newDate )
         
     years.reverse()
        
     self.years =  years   
开发者ID:hawkeye438,项目名称:metpx,代码行数:22,代码来源:TotalsGraphicsWebPagesGenerator.py

示例13: filterClientsNamesUsingWilcardFilters

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
 def filterClientsNamesUsingWilcardFilters( currentTime, timespan, clientNames, machines, fileTypes ):
     """
     
         @param currentTime: currentTime specified in the parameters.
         @param timespan: Time span specified within the parameters.
         @param clientNames:List of client names found in the parameters.
     
     """
     
     newClientNames = []
     
     end   = currentTime
     start = StatsDateLib.getIsoFromEpoch( StatsDateLib.getSecondsSinceEpoch(currentTime)- 60*60*timespan )
     
     if len(clientNames) >=  len( fileTypes ) or len( fileTypes ) ==1:
         
         if len( fileTypes ) == 1 :
             for i in range(1, len( clientNames ) ):
                 fileTypes.append( fileTypes[0])
         
         for clientName,fileType in map( None, clientNames, fileTypes ):
                             
             if  '?' in clientName or '*' in clientName :           
                 
                 pattern =clientName
                
                 rxHavingRun,txHavingRun = GeneralStatsLibraryMethods.getRxTxNamesHavingRunDuringPeriod(start, end, machines, pattern)
                 
                 if fileType == "rx":
                     namesHavingrun = rxHavingRun
                 else:    
                     namesHavingrun = txHavingRun
                 
                 newClientNames.extend( namesHavingrun )   
                     
                     
             else:
                 newClientNames.append( clientName )   
         
         
     return newClientNames
开发者ID:hawkeye438,项目名称:metpx,代码行数:43,代码来源:GeneralStatsLibraryMethods.py

示例14: getMissingWeeksBetweenUpdates

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
 def getMissingWeeksBetweenUpdates(self, update1InIsoFormat, update2InIsoFormat ):
     """
         @summary : Returns the list of days between update date 1 and update date 2.
         
         @Note : If update1InIsoFormat = 2008-02-28 15:00:00 and 
                    update2InIsoFormat = 2008-02-28 15:00:00
                 this method would return [ 2008-02-28 15:00:00 ]    
         
         @return : Returns the list of days between update date 1 and update date 2.
                   
     """
     
     missingWeeks = []
     
     if update2InIsoFormat > update1InIsoFormat:
             weekInIsoFormat = update1InIsoFormat
             while weekInIsoFormat <= update2InIsoFormat :
                 missingWeeks.append( weekInIsoFormat )
                 weekInIsoFormat = StatsDateLib.getIsoFromEpoch(  StatsDateLib.getSecondsSinceEpoch( weekInIsoFormat ) + ( StatsDateLib.DAY*7 )  )
                
     return missingWeeks[:-1] 
开发者ID:hawkeye438,项目名称:metpx,代码行数:23,代码来源:AutomaticUpdatesManager.py

示例15: getStartTimeAndEndTime

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getSecondsSinceEpoch [as 别名]
 def getStartTimeAndEndTime( self, collectUptoNow = False ):
     """
         @summary : Returns the startTime and endTime of the graphics.
         
         @warning : collectUptoNow not yet supported in program !
         
         @return : the startTime and endTime of the graphics.
         
     """
     
     
     #Now not yet implemented.
     if collectUptoNow == True :
         endTime = self.currentTime
         
     else :
         endTime = StatsDateLib.getIsoWithRoundedHours( self.currentTime )
         
     startTime = StatsDateLib.getIsoFromEpoch( StatsDateLib.getSecondsSinceEpoch( endTime ) - (self.timespan * StatsDateLib.HOUR) )  
      
     return startTime, endTime
开发者ID:hawkeye438,项目名称:metpx,代码行数:23,代码来源:GnuGraphicProducer.py


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