Example #1
0
def getDBasDict(dbName):
    '''
    Helper function returns an ACS performance database as a Python dictionary.
    In this dict, the keys are the test type and the values are lists of tests.
    '''
    if findFile(dbName)[0]!="":
        dbName=findFile(dbName)[0]

    DB = anydbm.open(DBNAME, 'r')

    retVal = {}

    #get each and every individual test from the database
    for key in DB.keys():
        #turn the value back into a Python dictionary
        tDict = eval(DB[key])

        #now figure out what type of performance test we're dealing with...
        msg = tDict['msg']

        #add this type of performance test to the return dictionary if it has
        #not been encountered previously
        if not retVal.has_key(msg):
            retVal[msg]=[]

        #add the dictionary describing the test to the return value
        retVal[msg].append(tDict)

    DB.close()
    return retVal
Example #2
0
def analyzeOutput(fileName, dbName):
    '''
    Analyze 
    '''
    #Open the file which contains one or more lines beginning with '#ACS PROFILER#'
    if findFile(fileName)[0] != "":
        fileName = findFile(fileName)[0]
    fileObj = open(fileName, 'r')

    #open the database
    if findFile(dbName)[0] != "":
        dbName = findFile(dbName)[0]
    db = anydbm.open(dbName, 'c')

    #Search through every line of the file looking for lines to analyze
    for line in fileObj:
        analyzeLine(line, db)

    #close the database and file
    db.close()
    fileObj.close()
Example #3
0
    def getCDBInfo(self):
        '''
        getCDBInfo is a helper method which is responsible for retrieving info
        from the CDB associated with this container.

        Parameters: None

        Return: None

        Raises: ???
        '''
        #obtain generic container information
        try:
            self.cdbContainerInfo = self.cdbAccess.getElement("MACI/Containers/"  + self.name, "Container")
        except:
            self.logger.logDebug("No container information found in the CDB")
            return

        #get a list of libraries to preload
        # [{'string': 'baci'}]
        temp_list = []
        try:
            temp_list = self.cdbAccess.getElement("MACI/Containers/" + self.name + "/Autoload", "Autoload/cdb:_")
        except:
            self.logger.logDebug("No autoload elemnt found in the CDB")
            return

        #get rid of libraries that can't be found!
        for temp_dict in temp_list:
            package = temp_dict['string']
            package = findFile("bin/" + str(package))[0]
            if package != "":
                #if it really exists add it
                self.autoLoadPackages.append(package)
            else:
                self.logger.logAlert("The '" + str(temp_dict['string']) + "' Python script specified by this container's CDB Autoload element cannot be found!")

        #now try loading the packages!
        for temp_package in self.autoLoadPackages:
            try:
                execfile(temp_package)
            except:
                self.logger.logCritical("There was a problem autoloading the '" + str(temp_package) + "' Python script!")
                print_exc()
                
        try:
            #Get the global unnamed logging config to retrieve the maxLogsPerSecond attribute
            logconfigG = self.cdbAccess.getElement("MACI/Containers/"  + self.name + "/LoggingConfig", "LoggingConfig")
            maxLogsPerSec = int(logconfigG[0]['maxLogsPerSecond'])
        except (CDBRecordDoesNotExistEx):
            # No value was supplied so default is used
            maxLogsPerSec = -1
        self.logger.configureLogging(maxLogsPerSec,self.clta)
Example #4
0
def analyzeOutput(fileName, dbName):
    '''
    Analyze 
    '''
    #Open the file which contains one or more lines beginning with '#ACS PROFILER#'
    if findFile(fileName)[0]!="":
        fileName = findFile(fileName)[0]
    fileObj = open(fileName, 'r')

    #open the database
    if findFile(dbName)[0]!="":
        dbName=findFile(dbName)[0]
    db = anydbm.open(dbName, 'c')
    

    #Search through every line of the file looking for lines to analyze
    for line in fileObj:
        analyzeLine(line, db)

    #close the database and file
    db.close()
    fileObj.close()
Example #5
0
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307  USA
#
# @(#) $Id: acsutilpyTestFindFile.py,v 1.2 2004/10/04 20:18:32 dfugate Exp $
###############################################################################
'''
Tests find file.
'''
import sys
from AcsutilPy.FindFile import findFile
###############################################################################
# Test code
#
# From command line, will search for a given file using
# acsFindFile, and print the resulting file name.
#
if __name__ == "__main__":
    print findFile(sys.argv[1])[0]
Example #6
0
from os.path import abspath, basename
from AcsutilPy.FindFile import findFile

################################################################################################
if __name__ != "__main__":
    # pydoc -w is running this script!
    from sys import exit

    print "This script should not be imported as a module!"
    exit(0)
################################################################################################
# this should be : or ;. In any event, it's the first parameter to this script used as the
# classpath seperator
cpsep = argv[1]

# to be a list of all jar files in the directories specified from the command-line
retString = ""

# for each jar specified in the command-line
for jar in argv[2].split(cpsep):
    # look up the location
    location = findFile("lib/" + jar)[0]

    # if it's valid; add it
    if location != "":
        retString = retString + location + cpsep

################################################################################################
# print the $CLASSPATH to standard out
print retString
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
# MA 02111-1307  USA
#
# @(#) $Id: acsutilpyTestFindFile.py,v 1.2 2004/10/04 20:18:32 dfugate Exp $
###############################################################################
'''
Tests find file.
'''
import sys
from AcsutilPy.FindFile import findFile
###############################################################################
# Test code
#
# From command line, will search for a given file using
# acsFindFile, and print the resulting file name.
#
if __name__ == "__main__":
    print findFile(sys.argv[1])[0]
Example #8
0
from sys import argv
from os import listdir
from os.path import abspath, basename
from AcsutilPy.FindFile import findFile
################################################################################################
if __name__ != "__main__":
    #pydoc -w is running this script!
    from sys import exit
    print "This script should not be imported as a module!"
    exit(0)
################################################################################################
#this should be : or ;. In any event, it's the first parameter to this script used as the
#classpath seperator
cpsep = argv[1]

#to be a list of all jar files in the directories specified from the command-line
retString = ""

#for each jar specified in the command-line
for jar in argv[2].split(cpsep):
    #look up the location
    location = findFile("lib/" + jar)[0]

    #if it's valid; add it
    if location != "":
        retString = retString + location + cpsep

################################################################################################
#print the $CLASSPATH to standard out
print retString