Example #1
0
 def ensureAllUsingInstancesActive():
     usingInstancesIds = UsingInstancesDBUtil.getAllUsingInstancesIds()
     while usingInstancesIds:
         for uiid in usingInstancesIds:
             if InstanceUtil.isInstanceStatusActice(uiid):
                 usingInstancesIds.remove(uiid)
         time.sleep(5)
Example #2
0
    def getAllUsingInstancesPeriodAVGMemoryUtil():
        allUiIds = UsingInstancesDBUtil.getAllUsingInstancesIds()

        uiAvgMemoryList = []

        for uiId in allUiIds:
            uiAvgMemoryList.append(
                SampleUtil.getMemoryUtilPeriodAVGByResourceId(uiId))

        if uiAvgMemoryList:
            return avgNumberList(uiAvgMemoryList)
        else:
            return None
Example #3
0
    def getThreadInfosOverAllUsingInstances(jump_server):
        allUiIds = UsingInstancesDBUtil.getAllUsingInstancesIds()

        uiAvgCPUList = []
        totalCalculation = 0.0

        for uiId in allUiIds:
            tmp = SampleUtil.getThreadInfoByResourceId(uiId, jump_server)
            uiAvgCPUList.append(tmp["util"])
            totalCalculation += tmp["cal"]

        if uiAvgCPUList:
            return avgNumberList(uiAvgCPUList), totalCalculation
        else:
            return None
Example #4
0
 def resetAllUsingInstances():
     usingInstancesIds = UsingInstancesDBUtil.getAllUsingInstancesIds()
     for uiid in usingInstancesIds:
         InstanceUtil.rebootInstanceById(uiid)