Exemplo n.º 1
0
 def __init__(self, _strName=None):
     EDObject.__init__(self)
     strName = None
     if _strName is None:
         strName = self.getClassName()
     else:
         strName = _strName
     iId = self.getId()
     #self.__loggingId = "%s-%d" % (strName, iId)
     self.__loggingId = strName
     EDLoggingPyLogging.__semaphoreLogging.acquire()
     if not EDLoggingPyLogging.__bInitisalised:
         logging.basicConfig(level=EDLoggingPyLogging.__logLevel,
                             stream=sys.stdout)
         logging.addLevelName(EDLoggingPyLogging.UNIT_TEST_LEVEL,
                              EDLoggingPyLogging.UNIT_TEST_NAME)
         logging.addLevelName(EDLoggingPyLogging.ASSERT_LEVEL,
                              EDLoggingPyLogging.ASSERT_NAME)
         EDLoggingPyLogging.__bInitisalised = True
     if not self.__loggingId in EDLoggingPyLogging.__dictLoggers.keys():
         self.logger = logging.getLogger(self.__loggingId)
         self.logger.setLevel(EDLoggingPyLogging.__logLevel)
         EDLoggingPyLogging.__dictLoggers[self.__loggingId] = self.logger
     else:
         self.logger = EDLoggingPyLogging.__dictLoggers[self.__loggingId]
     EDLoggingPyLogging.__semaphoreLogging.release()
     self.__bIsTest = False
     self.__bIsVerboseDebug = False
     self.__strLogFileName = None
     self.__bIsLogFile = False
Exemplo n.º 2
0
 def __init__(self, _strLoggerName="EDVerbose"):
     EDObject.__init__(self)
     if _strLoggerName == "PyLogging":
         self.edLogging = EDLoggingPyLogging()
     else:
         self.edLogging = EDLoggingVerbose()
     self.__messages = []
Exemplo n.º 3
0
 def __init__(self):
     EDObject.__init__(self)
     threading.Thread.__init__(self)
     self.__dictPlugin = {}
     #self.__strHost = socket.get
     self.__strHost = socket.gethostbyname_ex(socket.gethostname())[2][0]
     self.__iPort = 8000
Exemplo n.º 4
0
 def __init__(self, _strPluginName):
     """
     Constructor of the class
     
     @param strPluginName: name of the plugin 
     @type strPluginName: string
     """
     EDObject.__init__(self)
     self.__strPluginName = _strPluginName
     self.__edPlugin = None
     self.__edSlotCallBack = EDSlot()
     self.__edSlotSUCCESS = EDSlot()
     self.__edSlotFAILURE = EDSlot()
     self.__bXmlInputSet = False
     self.__status = None
     #        self.__edPlugin = EDJob.__edFactoryPlugin.loadPlugin(self.__strPluginName)
     self.__edPlugin = EDPluginWrapperForJobScheduler(self.__strPluginName)
     EDJob.__semaphore.acquire()
     #        Create the JobID
     if not self.__strPluginName in EDJob.__dictPluginLastId:
         EDJob.__dictPluginLastId[_strPluginName] = 0
     else:
         EDJob.__dictPluginLastId[_strPluginName] += 1
     self.__jobId = "%s-%i" % (self.__strPluginName,
                               EDJob.__dictPluginLastId[_strPluginName])
     EDJob.__dictJobs[self.__jobId] = self
     EDJob.__semaphore.release()
     if (self.__edPlugin is None):
         EDVerbose.WARNING("Instantiation of plugin %s failed!!!" %
                           _strPluginName)
     else:
         self.__status = EDJob.PLUGIN_STATE_UNITIALIZED
Exemplo n.º 5
0
    def __init__(self, _strPluginName):
        """
        Constructor of the class
        
        @param strPluginName: name of the plugin 
        @type strPluginName: string
        """
        EDObject.__init__(self)
        self.__strPluginName = _strPluginName
        self.__edPlugin = None
        self.__edSlotCallBack = EDSlot()
        self.__edSlotSUCCESS = EDSlot()
        self.__edSlotFAILURE = EDSlot()
        self.__bXmlInputSet = False
        self.__status = None
#        self.__edPlugin = EDJob.__edFactoryPlugin.loadPlugin(self.__strPluginName)
        self.__edPlugin = EDPluginWrapperForJobScheduler(self.__strPluginName)
        EDJob.__semaphore.acquire()
#        Create the JobID
        if not self.__strPluginName in EDJob.__dictPluginLastId:
            EDJob.__dictPluginLastId[_strPluginName] = 0
        else:
            EDJob.__dictPluginLastId[_strPluginName] += 1
        self.__jobId = "%s-%i" % (self.__strPluginName, EDJob.__dictPluginLastId[_strPluginName])
        EDJob.__dictJobs[self.__jobId] = self
        EDJob.__semaphore.release()
        if (self.__edPlugin is None):
            EDVerbose.WARNING("Instantiation of plugin %s failed!!!" % _strPluginName)
        else:
            self.__status = EDJob.PLUGIN_STATE_UNITIALIZED
Exemplo n.º 6
0
 def __init__(self, _strName=None):
     EDObject.__init__(self)
     with EDLoggingPyLogging.__semaphoreLogging:
         if not EDLoggingPyLogging.__bInitisalised:
             logging.addLevelName(EDLoggingPyLogging.UNIT_TEST_LEVEL,
                                  EDLoggingPyLogging.UNIT_TEST_NAME)
             logging.addLevelName(EDLoggingPyLogging.ASSERT_LEVEL,
                                  EDLoggingPyLogging.ASSERT_NAME)
             EDLoggingPyLogging.__bInitisalised = True
             self.logger = logging.getLogger("EDNA")
             self.logger.setLevel(logging.DEBUG)
             self.stream_hdlr = logging.StreamHandler(strm=sys.stdout)
             stream_formatter = logging.Formatter(
                 '  %(levelname)-10s: %(message)s')
             self.stream_hdlr.setFormatter(stream_formatter)
             self.stream_hdlr.setLevel(EDLoggingPyLogging.__logLevel)
             self.logger.addHandler(self.stream_hdlr)
         else:
             self.logger = logging.getLogger("EDNA")
             self.logger.setLevel(logging.DEBUG)
             self.stream_hdlr = None
     self.__bIsTest = False
     self.__bIsVerboseDebug = False
     self.__strLogFileName = None
     self.__bIsLogFile = False
     self.info_hdlr = None
     self.debug_hdlr = None
Exemplo n.º 7
0
 def __init__(self, _strName=None):
     EDObject.__init__(self)
     strName = None
     if _strName is None:
         strName = self.getClassName()
     else:
         strName = _strName
     iId = self.getId()
     #self.__loggingId = "%s-%d" % (strName, iId)
     self.__loggingId = strName
     EDLoggingPyLogging.__semaphoreLogging.acquire()
     if not EDLoggingPyLogging.__bInitisalised:
         logging.basicConfig(level=EDLoggingPyLogging.__logLevel, stream=sys.stdout)
         logging.addLevelName(EDLoggingPyLogging.UNIT_TEST_LEVEL, EDLoggingPyLogging.UNIT_TEST_NAME)
         logging.addLevelName(EDLoggingPyLogging.ASSERT_LEVEL, EDLoggingPyLogging.ASSERT_NAME)
         EDLoggingPyLogging.__bInitisalised = True
     if not self.__loggingId in EDLoggingPyLogging.__dictLoggers.keys():
         self.logger = logging.getLogger(self.__loggingId)
         self.logger.setLevel(EDLoggingPyLogging.__logLevel)
         EDLoggingPyLogging.__dictLoggers[self.__loggingId] = self.logger
     else:
         self.logger = EDLoggingPyLogging.__dictLoggers[self.__loggingId]
     EDLoggingPyLogging.__semaphoreLogging.release()
     self.__bIsTest = False
     self.__bIsVerboseDebug = False
     self.__strLogFileName = None
     self.__bIsLogFile = False
Exemplo n.º 8
0
 def __init__(self):
     EDObject.__init__(self)
     threading.Thread.__init__(self)
     self.__dictPlugin = {}
     #self.__strHost = socket.get
     self.__strHost = socket.gethostbyname_ex(socket.gethostname())[2][0]
     self.__iPort = 8000
Exemplo n.º 9
0
 def __init__(self, _pyStrNameTest="Test", _iNumberTest=0):
     EDObject.__init__(self)
     self.__strNameTest = _pyStrNameTest
     self.__strException = None
     self.__iNumberTest = _iNumberTest
     self.__bSuccess = True
     self.__listTest = []
     self.setTimeInit()
Exemplo n.º 10
0
 def __init__(self, _pyStrNameTest="Test", _iNumberTest=0):
     EDObject.__init__(self)
     self.__strNameTest = _pyStrNameTest
     self.__strException = None
     self.__iNumberTest = _iNumberTest
     self.__bSuccess = True
     self.__listTest = []
     self.setTimeInit()
Exemplo n.º 11
0
 def __init__(self, _strTestName="Test"):
     EDObject.__init__(self)
     if _strTestName is None:
         self.__strTestName = self.getClassName()
     else:
         self.__strTestName = _strTestName
     self.__listTest = []
     self.__bIsVerbose = False
     self.__bIsDebug = False
     self.__bIsAssert = False
     self.__bIsLogFile = False
     self.__bIsProfile = False
Exemplo n.º 12
0
 def __init__(self, _strName=None):
     EDObject.__init__(self)
     with EDLoggingPyLogging.__semaphoreLogging:
         if not EDLoggingPyLogging.__bInitisalised:
             logging.addLevelName(EDLoggingPyLogging.UNIT_TEST_LEVEL, EDLoggingPyLogging.UNIT_TEST_NAME)
             logging.addLevelName(EDLoggingPyLogging.ASSERT_LEVEL, EDLoggingPyLogging.ASSERT_NAME)
             EDLoggingPyLogging.__bInitisalised = True
             self.logger = logging.getLogger("EDNA")
             self.logger.setLevel(logging.DEBUG)
             self.stream_hdlr = logging.StreamHandler(strm=sys.stdout)
             stream_formatter = logging.Formatter('  %(levelname)-10s: %(message)s')
             self.stream_hdlr.setFormatter(stream_formatter)
             self.stream_hdlr.setLevel(EDLoggingPyLogging.__logLevel)
             self.logger.addHandler(self.stream_hdlr)
         else:
             self.logger = logging.getLogger("EDNA")
             self.logger.setLevel(logging.DEBUG)
             self.stream_hdlr = None
     self.__bIsTest = False
     self.__bIsVerboseDebug = False
     self.__strLogFileName = None
     self.__bIsLogFile = False
     self.info_hdlr = None
     self.debug_hdlr = None
Exemplo n.º 13
0
 def __init__(self):
     EDObject.__init__(self)
Exemplo n.º 14
0
class EDManagerTest(EDObject):
    """
    Static class for storing all test information / results.
    """
    __listTest = []
    __listTestTotal = []
    __semaphore = EDObject()
    __edTestRunning = None
    __iCumulativeTotalTest = 0
    __iCumulativeTotalTestMethod = 0
    __iCumulativeTotalTestSuccess = 0
    __iCumulativeTotalTestFailure = 0
    __pyStrReport = None


    @classmethod
    def synchronizeOn(cls):
        """
        Locks the EDManagerTest class
        """
        cls.__semaphore.synchronizeOn()


    @classmethod
    def synchronizeOff(cls):
        """
        Unlocks the EDManagerTest class
        """
        cls.__semaphore.synchronizeOff()


    @classmethod
    def create(cls):
        """
        Create
        """
        cls.__iCumulativeTotalTest += cls.getNumberTest()
        cls.__iCumulativeTotalTestMethod += cls.getNumberTestMethod()
        cls.__iCumulativeTotalTestSuccess += cls.getNumberTestSuccess()
        cls.__iCumulativeTotalTestFailure += cls.getNumberTestFailure()
        with cls.__semaphore:
            for edTest in cls.__listTest:
                cls.__listTestTotal.append(edTest)
            del cls.__listTest
            cls.__listTest = []


    @classmethod
    def outputScreen(cls):
        with cls.__semaphore:
            strMessage = ""
            strMessage += "\n  ===============================================================================\n"
            strMessage += "  Final Report\n"
            strMessage += "                            Date: %s\n" % time.strftime("%Y/%m/%d-%H:%M:%S", time.localtime())
            strMessage += "           Total Cumulated Tests: [ %d ]\n" % cls.__iCumulativeTotalTest
            strMessage += "    Total Cumulated Test SUCCESS: [ %d ]\n" % cls.__iCumulativeTotalTestSuccess
            strMessage += "   Total Cumulated Test FAILLURE: [ %d ]\n" % cls.__iCumulativeTotalTestFailure
            strMessage += "    Total Cumulated Test Methods: [ %d ]\n" % cls.__iCumulativeTotalTestMethod
            strMessage += "  -------------------------------------------------------------------------------\n"
            strFailedTests = ""
            for edTest in cls.__listTestTotal:
                strMessage += edTest.outputString()
                if (not edTest.isSuccess()):
                    strFailedTests += edTest.outputString()
            strMessage += "\n  ===============================================================================\n"
            if (strFailedTests != ""):
                strMessage += "  Failed tests:\n"
                strMessage += strFailedTests
            cls.__pyStrReport = strMessage
            EDVerbose.screen(cls.__pyStrReport)
        cls.synchronizeOff()


    @classmethod
    def getNumberTestCumulative(cls):
        return cls.__iCumulativeTotalTest


    @classmethod
    def getNumberTestMethodCumulative(cls):
        return cls.__iCumulativeTotalTestMethod


    @classmethod
    def getNumberTestSuccessCumulative(cls):
        return cls.__iCumulativeTotalTestSuccess


    @classmethod
    def getNumberTestFailureCumulative(cls):
        return cls.__iCumulativeTotalTestFailure


    @classmethod
    def addInformationTest(cls, _edInformationTest):
        with cls.__semaphore:
            cls.__edTestRunning = _edInformationTest
            cls.__listTest.append(_edInformationTest)


    @classmethod
    def addInformationTestMethod(cls, _edInformationTest):
        with cls.__semaphore:
            if (cls.__edTestRunning is not None):
                cls.__edTestRunning.addInformationTest(_edInformationTest)


    @classmethod
    def getNumberTest(cls):
        with cls.__semaphore:
            iNumberTestTotal = len(cls.__listTest)
        return iNumberTestTotal


    @classmethod
    def getNumberTestMethod(cls):
        with cls.__semaphore:
            iNumberTestTotal = 0
            for edTest in cls.__listTest:
                iNumberTestTotal += edTest.getNumberTestMethod()
        return iNumberTestTotal


    @classmethod
    def getNumberTestSuccess(cls):
        with cls.__semaphore:
            iNumberTestTotal = 0
            for edTest in cls.__listTest:
                if (edTest.isSuccess()):
                    iNumberTestTotal += 1
        return iNumberTestTotal


    @classmethod
    def getNumberTestFailure(cls):
        with cls.__semaphore:
            iNumberTestTotal = 0
            for edTest in cls.__listTest:
                if (not edTest.isSuccess()):
                    iNumberTestTotal += 1
        return iNumberTestTotal
Exemplo n.º 15
0
    print("All %i jobs queued after %.3fs" % (len(args), time.time() - reprocess.startTime))
    reprocess.join()
    if yappi: yappi.stop()
    print("All %i jobs processed after %.3fs" % (len(args), time.time() - reprocess.startTime))
    print reprocess.statistics()
    if yappi:
        stat = yappi.get_stats(sort_type=yappi.SORTTYPE_TTOT)
        res = {}
        for i in stat.func_stats:
            if i[0] in res:
                res[i[0]][0] += i[1]
                res[i[0]][1] += i[2]
            else:
                res[i[0]] = [i[1], i[2]]
        keys = res.keys()
        keys.sort(sortn)
        with open("yappi.out", "w") as f:
            f.write("ncall\t\ttotal\t\tpercall\t\tfunction%s" % (os.linesep))
            for i in keys:
                f.write("%8s\t%16s\t%16s\t%s%s" % (res[i][0], res[i][1], res[i][1] / res[i][0], i, os.linesep))
        print("Profiling information written in yappi.out")
    edJob = EDJob(options.plugin.replace("EDPluginBioSaxsHPLC", "EDPluginBioSaxsFlushHPLC"))
    edJob.setDataInput(open(fullargs[-1], "r").read())
    edJob.execute()
    edJob.synchronizeAll()
    if options.profile:
        for i in EDObject.analyze_profiling():
            print(i)


Exemplo n.º 16
0
    print("All %i jobs processed after %.3fs" %
          (len(args), time.time() - reprocess.startTime))
    print reprocess.statistics()
    if yappi:
        stat = yappi.get_stats(sort_type=yappi.SORTTYPE_TTOT)
        res = {}
        for i in stat.func_stats:
            if i[0] in res:
                res[i[0]][0] += i[1]
                res[i[0]][1] += i[2]
            else:
                res[i[0]] = [i[1], i[2]]
        keys = res.keys()
        keys.sort(sortn)
        with open("yappi.out", "w") as f:
            f.write("ncall\t\ttotal\t\tpercall\t\tfunction%s" % (os.linesep))
            for i in keys:
                f.write("%8s\t%16s\t%16s\t%s%s" %
                        (res[i][0], res[i][1], res[i][1] / res[i][0], i,
                         os.linesep))
        print("Profiling information written in yappi.out")
    edJob = EDJob(
        options.plugin.replace("EDPluginBioSaxsHPLC",
                               "EDPluginBioSaxsFlushHPLC"))
    edJob.setDataInput(open(fullargs[-1], "r").read())
    edJob.execute()
    edJob.synchronizeAll()
    if options.profile:
        for i in EDObject.analyze_profiling():
            print(i)
Exemplo n.º 17
0
 def __init__(self, _strName=None):
     EDObject.__init__(self)
     self.edLogging = EDLoggingVerbose()
Exemplo n.º 18
0
 def __init__(self, _strLoggerName=None):
     EDObject.__init__(self)
     if _strLoggerName == "PyLogging":
         self.edLogging = EDLoggingPyLogging()
     else:
         self.edLogging = EDLoggingVerbose()
Exemplo n.º 19
0
 def __init__(self):
     """
     """
     EDObject.__init__(self)
     self.__listMethod = []
Exemplo n.º 20
0
 def __init__(self, _strName=None):
     EDObject.__init__(self)
     self.edLogging = EDLoggingVerbose()
Exemplo n.º 21
0
 def __init__(self):
     EDObject.__init__(self)
Exemplo n.º 22
0
 def __init__(self):
     """
     """
     EDObject.__init__(self)
     self.__listMethod = []