Esempio n. 1
0
 def execute( self ):
   """ Main execution method
   """
   # Get list of running jobs
   dao = SAMDB()
   runningTests = dao.getRunningTests()['Value']
   # Leave only old
   testsToStop = []
   for test in runningTests:
     print test[2]
     if isTimeExceed(test[2], 600):
       testsToStop.append(test)
   # Send JobKill through REST
   for test in testsToStop:
     result = deleteJob(test[1])
     if result:
       dao.setResult('Fail', test[0], 'Failed after 10 min of silence')
   return S_OK()
Esempio n. 2
0
  def execute( self ):
    """ Main execution method
    """
    self.log.info( "    TICK!!" )
    self.log.info( self.am_getOption("PollingTime") )
    # Get list of tests
    dao = SAMDB()
    testList = dao.getTestsToRun()['Value']
    print testList
    # Leave only old and Finished
    testsToRun = []
    for test in testList:
      self.log.info(str(test[3])+"  "+str(test[4]))
      self.log.info(str(getTimeNow())+"  "+str(long(test[3].strftime('%s'))))
      self.log.info(getTimeNow()-long(test[3].strftime('%s')))

      if isTimeExceed(test[3], test[4]):
        self.log.info(str(test[3])+"  "+str(test[4]))
        self.log.info(str(getTimeNow())+"  "+str(long(test[3].strftime('%s'))))
        self.log.info(getTimeNow()-long(test[3].strftime('%s')))
        testsToRun.append(test)
    # Create new Result db entity
    for test in testsToRun:
      result_id = dao.createNewResult(test[6], test[7])
      wms_id = sendJob(test[0], test[2], result_id['Value'])
      print 'wms_id ',  wms_id
      if wms_id != 0:
        dao.createJob(wms_id,test[6], result_id['Value'])
      else:
        dao.setResult('Fail', result_id['Value'], 'Failed to submit the job')
    # Try to send job
      #IF failed to get job_id - mark FAIL
      #NEXT
    # Create Job db entity
    # Update result
    return S_OK()