def __call__(self, destination=None): """ _operator()_ Query BossLite Here.... """ #sqlStr1 = \ """ select count(bl_job.id) from bl_job,bl_runningjob where bl_runningjob.job_id=bl_job.job_id and bl_runningjob.task_id=bl_job.task_id and bl_job.name like '%pilot%' and bl_runningjob.status not in ('E','C','A','SD') and bl_runningjob.closed='N'; """ sqlStr1 = '' if ( destination!=None and destination.find('cern.ch')>0 ): sqlStr1 = \ """select count(bl_runningjob.id) from bl_task,bl_runningjob where bl_runningjob.task_id=bl_task.id and bl_task.job_type='PilotJob' and bl_runningjob.status not in ('E','C','A','SD') and bl_runningjob.closed='N'; """ elif ( destination != None): sqlStr1 = \ """select count(bl_runningjob.id) from bl_task,bl_runningjob where bl_runningjob.task_id=bl_task.id and bl_task.job_type='PilotJob' and bl_runningjob.destination='%s' and bl_runningjob.status not in ('E','C','A','SD') and bl_runningjob.closed='N'; """ % destination print sqlStr1 bossLiteDB = BossLiteDB( 'MySQL', dbConfig ) self.pilotJobs = bossLiteDB.selectOne( sqlStr1 ) print self.pilotJobs
def taskCount (self): """ __taskCount__ count the tasks in the table. helps in making unique name for tasks """ sql="select count(id) from bl_task" bossLiteDB = BossLiteDB( 'MySQL', dbConfig ) taskTotal = bossLiteDB.selectOne( sql ) return taskTotal
def __call__(self): """ _operator()_ Query BossLite Here.... """ ### config = loadProdAgentConfiguration() ### BOSSconfig = config.getConfig("BOSS") ### bossCfgDir = BOSSconfig['configDir'] sqlStr1 = \ """ select count(bl_job.id) from bl_job,bl_runningjob where bl_runningjob.job_id=bl_job.job_id and bl_runningjob.task_id=bl_job.task_id and bl_job.name not like '%merge%' and bl_job.name not like '%CleanUp%' and bl_job.name not like '%LogCollect%' and bl_runningjob.status not in ('E','C','A','SD') and bl_runningjob.closed='N'; """ sqlStr2 = \ """ select count(bl_job.id) from bl_job,bl_runningjob where bl_runningjob.job_id=bl_job.job_id and bl_runningjob.task_id=bl_job.task_id and bl_job.name like '%merge%' and bl_runningjob.status not in ('E','C','A','SD') and bl_runningjob.closed='N'; """ sqlStr3 = \ """ select count(bl_job.id) from bl_job,bl_runningjob where bl_runningjob.job_id=bl_job.id and bl_runningjob.task_id=bl_job.task_id and bl_job.name like '%CleanUp%' and bl_runningjob.status not in ('E','C','A','SD') and bl_runningjob.closed='N'; """ sqlStr4 = \ """ select count(bl_job.id) from bl_job,bl_runningjob where bl_runningjob.job_id=bl_job.id and bl_runningjob.task_id=bl_job.task_id and bl_job.name like '%LogCollect%' and bl_runningjob.status not in ('E','C','A','SD') and bl_runningjob.closed='N'; """ ### processingout=commands.getoutput("bossAdmin SQL -query \"%s\" -c %s"%(sqlStr1,bossCfgDir)) ### numProcessing=long(processingout.strip().split('\n')[1]) ### ### mergeout=commands.getoutput("bossAdmin SQL -query \"%s\" -c %s"%(sqlStr2,bossCfgDir)) ### numMerge=long(mergeout.strip().split('\n')[1]) ### ### cleanout=commands.getoutput("bossAdmin SQL -query \"%s\" -c %s"%(sqlStr3,bossCfgDir)) ### numClean=long(cleanout.strip().split('\n')[1]) bossLiteDB = BossLiteDB( 'MySQL', dbConfig ) numProcessing = bossLiteDB.selectOne( sqlStr1 ) numMerge = bossLiteDB.selectOne( sqlStr2 ) numClean = bossLiteDB.selectOne( sqlStr3 ) numCollect = bossLiteDB.selectOne( sqlStr4 ) # #BOSSdbConfig = dbConfig #BOSSdbConfig['dbName'] = "%s_BOSS"%(dbConfig['dbName'],) # #Session.set_database(BOSSdbConfig) #Session.connect() #Session.start_transaction() # #Session.execute(sqlStr1) #numProcessing = Session.fetchone()[0] #Session.execute(sqlStr2) #numMerge = Session.fetchone()[0] #Session.close_all() total = numProcessing + numMerge self['Total'] = total self['Processing'] = numProcessing self['Merge'] = numMerge self['CleanUp'] = numClean self['LogCollect'] = numCollect return