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()