Example #1
0
def test__performChecks():
    pid = os.getpid()
    wd = Watchdog(pid, mock_exeThread, mock_spObject, 5000)

    res = wd.calibrate()
    assert res["OK"] is True
    res = wd._performChecks()
    assert res["OK"] is True
Example #2
0
def test_performChecks():
    wd = Watchdog(pid=os.getpid(),
                  exeThread=MagicMock(),
                  spObject=MagicMock(),
                  jobCPUTime=1000,
                  memoryLimit=1024 * 1024,
                  jobArgs={'StopSigNumber': 10})
    res = wd._performChecks()
    assert res['OK']
Example #3
0
 def __init__(self,
              pid,
              thread,
              spObject,
              jobCPUtime,
              memoryLimit=0,
              processors=1,
              systemFlag='linux'):
     """ Constructor, takes system flag as argument.
 """
     Watchdog.__init__(self, pid, thread, spObject, jobCPUtime, memoryLimit,
                       processors, systemFlag)
Example #4
0
 def __init__(self, pid, exeThread, spObject, jobCPUTime, memoryLimit=0, processors=1, systemFlag='mac', jobArgs={}):
   """ Constructor, takes system flag as argument.
   """
   Watchdog.__init__(self,
                     pid=pid,
                     exeThread=exeThread,
                     spObject=spObject,
                     jobCPUTime=jobCPUTime,
                     memoryLimit=memoryLimit,
                     processors=processors,
                     systemFlag=systemFlag,
                     jobArgs=jobArgs)
Example #5
0
 def __init__( self, pid, exeThread, spObject, jobCPUTime, memoryLimit = 0, processors = 1, systemFlag = 'mac', jobArgs = {} ):
   """ Constructor, takes system flag as argument.
   """
   Watchdog.__init__( self, 
                      pid = pid, 
                      exeThread = exeThread, 
                      spObject = spObject, 
                      jobCPUTime = jobCPUTime, 
                      memoryLimit = memoryLimit, 
                      processors = processors, 
                      systemFlag = systemFlag, 
                      jobArgs = jobArgs )
Example #6
0
 def __init__(self,
              pid,
              thread,
              spObject,
              jobCPUtime,
              memoryLimit=0,
              systemFlag='mac'):
     """ Constructor, takes system flag as argument.
 """
     Watchdog.__init__(self, pid, thread, spObject, jobCPUtime, memoryLimit,
                       systemFlag)
     self.systemFlag = systemFlag
     self.pid = pid
Example #7
0
def test__performChecksFull():
    pid = os.getpid()
    wd = Watchdog(pid, mock_exeThread, mock_spObject, 5000)
    wd.testCPULimit = 1
    wd.testMemoryLimit = 1

    res = wd.calibrate()
    assert res["OK"] is True
    res = wd._performChecks()
    assert res["OK"] is True
Example #8
0
 def __init__(self, pid, thread, spObject, jobCPUtime, memoryLimit = 0, systemFlag='linux'):
   """ Constructor, takes system flag as argument.
   """
   Watchdog.__init__( self, pid, thread, spObject, jobCPUtime, memoryLimit, systemFlag )
   self.systemFlag = systemFlag
   self.pid = pid
Example #9
0
def test_calibrate():
    pid = os.getpid()
    wd = Watchdog(pid, mock_exeThread, mock_spObject, 5000)
    res = wd.calibrate()
    assert res['OK'] is True