示例#1
0
                if ( siteValues.has_key(siteSE) ):
                    siteValue = siteValues[siteSE]
                elif ( siteValues.has_key(siteSE) == False ):
                    siteValue = { 'ActivePilots':0, 'IdlePilots':0}

                result[siteSE] = runAlgorithm2 ( totalSubmittedPilots, siteSE, \
                                       siteThr, siteValue, taskPacks )
 
            return result

        except:           
            self.logger.debug(sys.exc_info()[0])
            self.logger.debug(sys.exc_info()[1])
            return {'Error':'ERROR'} 
             
registerMonitor(PilotBlSimpleMonitor, PilotBlSimpleMonitor.__name__)

#for testing purpose
if __name__ == '__main__':
   args = {'cpCmd':'rfcp','rfioSer':''}
   from WMCore import Configuration
   tqconfig = Configuration.loadConfigurationFile( \
                   "/data/khawar/antonio/tqcode/extras/WMCore-conf.py" )
   from TQComp.Apis.TQStateApi import TQStateApi
   myThread = threading.currentThread()
   logger = logging.getLogger()
   #self.logger.debug( tqconfig)
   tqStateApi = TQStateApi(logger, tqconfig, None)

   pbsched = PilotBlSimpleMonitor()
   pbsched.monitorAll(tqStateApi)
示例#2
0
                # logging.info("%s:%s"%(linelist[6], linelist[22]))
                jobList[linelist[0]] = linelist[6]

            self.logger.info("Pending Jobs: %s" % pendJobCount)
            self.logger.info("Running Jobs: %s" % runJobCount)

            # decision logic goes here
            totalSubmittedPilots = pendJobCount + runJobCount
            result = runAlgorithm(totalSubmittedPilots, siteThr)
            self.logger.info("Total Jobs (RUN+PEND): %s" % (totalSubmittedPilots))

            self.logger.info("PJ RequiredJobs: %s" % result["available"])

        except Exception, ex:
            # can only happen if bjobs call failed
            # do nothing in this case, next loop will work
            self.logger.info("Error in T0LSFPilotMonitor: %s, %s" % (sys.exc_info()[0], sys.exc_info()[1]))
            self.logger.info(traceback.format_stack())
            self.logger.info("Call to bjobs failed, just wait for next loop")
            return {"Error": "ERROR"}

        return result


registerMonitor(T0LSFPilotMonitor, T0LSFPilotMonitor.__name__)
"""     
if ( __name__ == '__main__'):
    t = T0LSFPilotMonitor()  
    t('CERN')
"""