當前位置: 首頁>>代碼示例>>Python>>正文


Python Client.killTask方法代碼示例

本文整理匯總了Python中pandatools.Client.killTask方法的典型用法代碼示例。如果您正苦於以下問題:Python Client.killTask方法的具體用法?Python Client.killTask怎麽用?Python Client.killTask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pandatools.Client的用法示例。


在下文中一共展示了Client.killTask方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: master_kill

# 需要導入模塊: from pandatools import Client [as 別名]
# 或者: from pandatools.Client import killTask [as 別名]
    def master_kill(self):
        '''Kill jobs'''  

        from pandatools import Client

        job = self.getJobObject()
        logger.debug('Killing job %s' % job.getFQID('.'))

        active_status = [ None, 'registered', 'waiting', 'defined', 'pending', 'assigning', 'ready', 'scouting', 'running', 'holding', 'merging', 'prepared', 'aborting', 'finishing' ]
        #active_status = [ None, 'defined', 'unknown', 'assigned', 'waiting', 'activated', 'sent', 'starting', 'running', 'holding', 'transferring' ]

        if self.id and self.status in active_status: 
            status, output = Client.killTask(self.id)
            if status:
                logger.error('Failed killing job (status = %d)',status)
                return False
            else:
                logger.info('Killing Jedi task %s, Server returned: %s' %(self.id, output))
        else:
            logger.error('Cannot kill Jedi job %s since it is not in active status', self.id)

        return True
開發者ID:MannyMoo,項目名稱:ganga,代碼行數:24,代碼來源:Jedi.py

示例2: kill

# 需要導入模塊: from pandatools import Client [as 別名]
# 或者: from pandatools.Client import killTask [as 別名]
 def kill(self,JobID,useJobsetID=False):
     # get logger
     tmpLog = PLogger.getPandaLogger()
     # check proxy
     self.gridPassPhrase,self.vomsFQAN = PsubUtils.checkGridProxy(
             self.gridPassPhrase,
             False,
             self.verbose,
             useCache=True)
     # force update just in case
     self.status(JobID,True)
     # get jobset
     jobList = self.getJobIDsWithSetID(JobID)
     if jobList == None:
         # works only for jobsetID
         if useJobsetID:
             return
         # works with jobID
         jobList = [JobID]
     else:
         tmpMsg = "ID=%s is composed of JobID=" % JobID
         for tmpJobID in jobList:
             tmpMsg += '%s,' % tmpJobID
         tmpMsg = tmpMsg[:-1]
         tmpLog.info(tmpMsg)
     for tmpJobID in jobList:    
         # get job info from local repository
         job = self.getJobInfo(tmpJobID)
         if job == None:
             tmpLog.warning("JobID=%s not found in local repository. Synchronization may be needed" % tmpJobID)            
             continue
         # skip frozen job
         if job.dbStatus == 'frozen':
             tmpLog.info('All subJobs in JobID=%s already finished/failed' % tmpJobID)
             continue
         if not job.isJEDI():
             # get PandaID list
             killJobs = job.PandaID.split(',')
             # kill
             tmpLog.info('Sending kill command ...')
             status,output = Client.killJobs(killJobs,self.verbose)
             if status != 0:
                 tmpLog.error(output)
                 tmpLog.error("Failed to kill JobID=%s" % tmpJobID)
                 return False
             # update database
             job.commandToPilot = 'tobekilled'
             # update DB
             try:
                 PdbUtils.updateJobDB(job,self.verbose)
             except:
                 tmpLog.error("Failed to update local repository for JobID=%s" % tmpJobID)
                 return False
         else:
             # kill JEDI task
             tmpLog.info('Sending killTask command ...')
             status,output = Client.killTask(job.jediTaskID,self.verbose)
             # communication error
             if status != 0:
                 tmpLog.error(output)
                 tmpLog.error("Failed to kill JobID=%s" % tmpJobID)
                 return False
             tmpStat,tmpDiag = output
             if not tmpStat:
                 tmpLog.error(tmpDiag)
                 tmpLog.error("Failed to kill JobID=%s" % tmpJobID)
                 return False
             tmpLog.info(tmpDiag)
         # done
         if job.isJEDI():
             tmpLog.info('Done. TaskID=%s will be killed in 30min' % job.jediTaskID)
         else:
             tmpLog.info('Done. JobID=%s will be killed in 30min' % tmpJobID)
     return True
開發者ID:PanDAWMS,項目名稱:panda-client,代碼行數:76,代碼來源:PBookCore.py


注:本文中的pandatools.Client.killTask方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。