Example #1
0
 def __init__(self,
              pid,
              exeThread,
              spObject,
              jobCPUtime,
              memoryLimit=0,
              systemFlag='linux2.4'):
     """ Constructor, takes system flag as argument.
 """
     self.log = gLogger.getSubLogger("Watchdog")
     self.systemFlag = systemFlag
     self.exeThread = exeThread
     self.wrapperPID = pid
     self.appPID = self.exeThread.getCurrentPID()
     self.spObject = spObject
     self.jobCPUtime = jobCPUtime
     self.memoryLimit = memoryLimit
     self.calibration = 0
     self.initialValues = {}
     self.parameters = {}
     self.peekFailCount = 0
     self.peekRetry = 5
     self.processMonitor = ProcessMonitor()
     self.checkError = ''
     self.currentStats = {}
     self.initialized = False
     self.count = 0
Example #2
0
    def __init__(self,
                 pid,
                 exeThread,
                 spObject,
                 jobCPUtime,
                 memoryLimit=0,
                 processors=1,
                 systemFlag='linux'):
        """ Constructor, takes system flag as argument.
    """
        self.log = gLogger.getSubLogger("Watchdog")
        self.systemFlag = systemFlag
        self.exeThread = exeThread
        self.wrapperPID = pid
        self.appPID = self.exeThread.getCurrentPID()
        self.spObject = spObject
        self.jobCPUtime = jobCPUtime
        self.memoryLimit = memoryLimit
        self.calibration = 0
        self.initialValues = {}
        self.parameters = {}
        self.peekFailCount = 0
        self.peekRetry = 5
        self.processMonitor = ProcessMonitor()
        self.checkError = ''
        self.currentStats = {}
        self.initialized = False
        self.count = 0

        #defaults
        self.testWallClock = 1
        self.testDiskSpace = 1
        self.testLoadAvg = 1
        self.maxWallClockTime = 3 * 24 * 60 * 60
        self.testCPUConsumed = 1
        self.testCPULimit = 0
        self.testMemoryLimit = 0
        self.testTimeLeft = 1
        self.pollingTime = 10  # 10 seconds
        self.checkingTime = 30 * 60  # 30 minute period
        self.minCheckingTime = 20 * 60  # 20 mins
        self.maxWallClockTime = 3 * 24 * 60 * 60  # e.g. 4 days
        self.jobPeekFlag = 1  # on / off
        self.minDiskSpace = 10  # MB
        self.loadAvgLimit = 1000  # > 1000 and jobs killed
        self.sampleCPUTime = 30 * 60  # e.g. up to 20mins sample
        self.jobCPUMargin = 20  # %age buffer before killing job
        self.minCPUWallClockRatio = 5  # ratio %age
        self.nullCPULimit = 5  # After 5 sample times return null CPU consumption kill job
        self.checkCount = 0
        self.nullCPUCount = 0

        self.grossTimeLeftLimit = 10 * self.checkingTime
        self.timeLeftUtil = TimeLeft()
        self.timeLeft = 0
        self.littleTimeLeft = False
        self.scaleFactor = 1.0
        self.processors = processors