本文整理汇总了Python中pandajedi.jedicore.MsgWrapper.MsgWrapper.warning方法的典型用法代码示例。如果您正苦于以下问题:Python MsgWrapper.warning方法的具体用法?Python MsgWrapper.warning怎么用?Python MsgWrapper.warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandajedi.jedicore.MsgWrapper.MsgWrapper
的用法示例。
在下文中一共展示了MsgWrapper.warning方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doActionForReassgin
# 需要导入模块: from pandajedi.jedicore.MsgWrapper import MsgWrapper [as 别名]
# 或者: from pandajedi.jedicore.MsgWrapper.MsgWrapper import warning [as 别名]
def doActionForReassgin(self,gTmpLog):
# get DDM I/F
ddmIF = self.ddmIF.getInterface(self.vo)
# get site mapper
siteMapper = self.taskBufferIF.getSiteMapper()
# get tasks to get reassigned
taskList = self.taskBufferIF.getTasksToReassign_JEDI(self.vo,self.prodSourceLabel)
gTmpLog.debug('got {0} tasks to reassign'.format(len(taskList)))
for taskSpec in taskList:
tmpLog = MsgWrapper(logger,'<jediTaskID={0}'.format(taskSpec.jediTaskID))
tmpLog.debug('start to reassign')
# DDM backend
ddmBackEnd = taskSpec.getDdmBackEnd()
# get datasets
tmpStat,datasetSpecList = self.taskBufferIF.getDatasetsWithJediTaskID_JEDI(taskSpec.jediTaskID,['output','log'])
if tmpStat != True:
tmpLog.error('failed to get datasets')
continue
# update DB
if not taskSpec.useWorldCloud():
# update cloudtasks
tmpStat = self.taskBufferIF.setCloudTaskByUser('jedi',taskSpec.jediTaskID,taskSpec.cloud,'assigned',True)
if tmpStat != 'SUCCEEDED':
tmpLog.error('failed to update CloudTasks')
continue
# check cloud
if not siteMapper.checkCloud(taskSpec.cloud):
tmpLog.error("cloud={0} doesn't exist".format(taskSpec.cloud))
continue
else:
# re-run task brokerage
if taskSpec.nucleus in [None,'']:
taskSpec.status = 'assigning'
taskSpec.oldStatus = None
taskSpec.setToRegisterDatasets()
self.taskBufferIF.updateTask_JEDI(taskSpec,{'jediTaskID':taskSpec.jediTaskID},
setOldModTime=True)
tmpLog.debug('set task_status={0} to trigger task brokerage again'.format(taskSpec.status))
continue
# get nucleus
nucleusSpec = siteMapper.getNucleus(taskSpec.nucleus)
if nucleusSpec == None:
tmpLog.error("nucleus={0} doesn't exist".format(taskSpec.nucleus))
continue
# set nucleus
retMap = {taskSpec.jediTaskID: AtlasBrokerUtils.getDictToSetNucleus(nucleusSpec,datasetSpecList)}
tmpRet = self.taskBufferIF.setCloudToTasks_JEDI(retMap)
# get T1/nucleus
if not taskSpec.useWorldCloud():
t1SiteName = siteMapper.getCloud(taskSpec.cloud)['dest']
else:
t1SiteName = nucleusSpec.getOnePandaSite()
t1Site = siteMapper.getSite(t1SiteName)
# loop over all datasets
isOK = True
for datasetSpec in datasetSpecList:
tmpLog.debug('dataset={0}'.format(datasetSpec.datasetName))
if DataServiceUtils.getDistributedDestination(datasetSpec.storageToken) != None:
tmpLog.debug('skip {0} is distributed'.format(datasetSpec.datasetName))
continue
# get location
location = siteMapper.getDdmEndpoint(t1Site.sitename,datasetSpec.storageToken)
# make subscription
try:
tmpLog.debug('registering subscription to {0} with backend={1}'.format(location,
ddmBackEnd))
tmpStat = ddmIF.registerDatasetSubscription(datasetSpec.datasetName,location,
'Production Output',asynchronous=True)
if tmpStat != True:
tmpLog.error("failed to make subscription")
isOK = False
break
except:
errtype,errvalue = sys.exc_info()[:2]
tmpLog.warning('failed to make subscription with {0}:{1}'.format(errtype.__name__,errvalue))
isOK = False
break
# succeeded
if isOK:
# activate task
if taskSpec.oldStatus in ['assigning','exhausted',None]:
taskSpec.status = 'ready'
else:
taskSpec.status = taskSpec.oldStatus
taskSpec.oldStatus = None
self.taskBufferIF.updateTask_JEDI(taskSpec,{'jediTaskID':taskSpec.jediTaskID},
setOldModTime=True)
tmpLog.debug('finished to reassign')
示例2: toBeThrottled
# 需要导入模块: from pandajedi.jedicore.MsgWrapper import MsgWrapper [as 别名]
# 或者: from pandajedi.jedicore.MsgWrapper.MsgWrapper import warning [as 别名]
def toBeThrottled(self,vo,prodSourceLabel,cloudName,workQueue,jobStat):
# component name
compName = 'prod_job_throttler'
# params
nBunch = 4
threshold = 2.0
thresholdForSite = threshold - 1.0
nJobsInBunchMax = 600
nJobsInBunchMin = 500
nJobsInBunchMaxES = 1000
if workQueue.criteria != None and 'site' in workQueue.criteria:
minTotalWalltime = 10*1000*1000
else:
minTotalWalltime = 50*1000*1000
nWaitingLimit = 4
nWaitingBunchLimit = 2
nParallel = 2
# make logger
tmpLog = MsgWrapper(logger)
workQueueIDs = workQueue.getIDs()
msgHeader = '{0}:{1} cloud={2} queue={3}:'.format(vo,prodSourceLabel,cloudName,workQueue.queue_name)
tmpLog.debug(msgHeader+' start workQueueID={0}'.format(str(workQueueIDs)))
# change threashold
if workQueue.queue_name in ['mcore']:
threshold = 5.0
# check cloud status
if not self.siteMapper.checkCloud(cloudName):
msgBody = "SKIP cloud={0} undefined".format(cloudName)
tmpLog.warning(msgHeader+" "+msgBody)
tmpLog.sendMsg(msgHeader+' '+msgBody,self.msgType,msgLevel='warning')
return self.retThrottled
cloudSpec = self.siteMapper.getCloud(cloudName)
if cloudSpec['status'] in ['offline']:
msgBody = "SKIP cloud.status={0}".format(cloudSpec['status'])
tmpLog.warning(msgHeader+" "+msgBody)
tmpLog.sendMsg(msgHeader+' '+msgBody,self.msgType,msgLevel='warning')
return self.retThrottled
if cloudSpec['status'] in ['test']:
if workQueue.queue_name != 'test':
msgBody = "SKIP cloud.status={0} for non test queue ({1})".format(cloudSpec['status'],
workQueue.queue_name)
tmpLog.sendMsg(msgHeader+' '+msgBody,self.msgType,msgLevel='warning')
tmpLog.warning(msgHeader+" "+msgBody)
return self.retThrottled
# check if unthrottled
if workQueue.queue_share == None:
msgBody = "PASS unthrottled since share=None"
tmpLog.debug(msgHeader+" "+msgBody)
return self.retUnThrottled
# count number of jobs in each status
nRunning = 0
nNotRun = 0
nDefine = 0
nWaiting = 0
for workQueueID in workQueueIDs:
if jobStat.has_key(cloudName) and \
jobStat[cloudName].has_key(workQueueID):
tmpLog.debug(msgHeader+" "+str(jobStat[cloudName][workQueueID]))
for pState,pNumber in jobStat[cloudName][workQueueID].iteritems():
if pState in ['running']:
nRunning += pNumber
elif pState in ['assigned','activated','starting']:
nNotRun += pNumber
elif pState in ['defined']:
nDefine += pNumber
elif pState in ['waiting']:
nWaiting += pNumber
# check if higher prio tasks are waiting
tmpStat,highestPrioJobStat = self.taskBufferIF.getHighestPrioJobStat_JEDI('managed',cloudName,workQueue)
highestPrioInPandaDB = highestPrioJobStat['highestPrio']
nNotRunHighestPrio = highestPrioJobStat['nNotRun']
# the highest priority of waiting tasks
highestPrioWaiting = self.taskBufferIF.checkWaitingTaskPrio_JEDI(vo,workQueue,
'managed',cloudName)
if highestPrioWaiting == None:
msgBody = 'failed to get the highest priority of waiting tasks'
tmpLog.error(msgHeader+" "+msgBody)
return self.retTmpError
# high priority tasks are waiting
highPrioQueued = False
if highestPrioWaiting > highestPrioInPandaDB or (highestPrioWaiting == highestPrioInPandaDB and \
nNotRunHighestPrio < nJobsInBunchMin):
highPrioQueued = True
tmpLog.debug(msgHeader+" highestPrio waiting:{0} inPanda:{1} numNotRun:{2} -> highPrioQueued={3}".format(highestPrioWaiting,
highestPrioInPandaDB,
nNotRunHighestPrio,
highPrioQueued))
# set maximum number of jobs to be submitted
tmpRemainingSlot = int(nRunning*threshold-nNotRun)
if tmpRemainingSlot < nJobsInBunchMin:
# use the lower limit to avoid creating too many _sub/_dis datasets
nJobsInBunch = nJobsInBunchMin
else:
if workQueue.queue_name in ['evgensimul']:
# use higher limit for evgensimul
if tmpRemainingSlot < nJobsInBunchMaxES:
nJobsInBunch = tmpRemainingSlot
else:
nJobsInBunch = nJobsInBunchMaxES
else:
#.........这里部分代码省略.........
示例3: toBeThrottled
# 需要导入模块: from pandajedi.jedicore.MsgWrapper import MsgWrapper [as 别名]
# 或者: from pandajedi.jedicore.MsgWrapper.MsgWrapper import warning [as 别名]
#.........这里部分代码省略.........
nJobsInBunch = min(tmpRemainingSlot, nJobsInBunchMax)
# get cap
# set number of jobs to be submitted
if configQueueCap is None:
self.setMaxNumJobs(nJobsInBunch / nParallel)
else:
self.setMaxNumJobs(configQueueCap / nParallelCap)
# get total walltime
totWalltime = self.taskBufferIF.getTotalWallTime_JEDI(vo, prodSourceLabel, workQueue, resource_name, cloudName)
# log the current situation and limits
tmpLog.info("{0} nQueueLimit={1} nRunCap={2} nQueueCap={3}".format(msgHeader, nQueueLimit,
configRunningCap, configQueueCap))
tmpLog.info("{0} at global share level: nQueued={1} nDefine={2} nRunning={3}".format(msgHeader,
nNotRun_gs + nDefine_gs,
nDefine_gs, nRunning_gs))
tmpLog.info("{0} at resource type level: nQueued_rt={1} nDefine_rt={2} nRunning_rt={3} totWalltime={4}".format(msgHeader,
nNotRun_rt + nDefine_rt,
nDefine_rt, nRunning_rt,
totWalltime))
# check number of jobs when high priority jobs are not waiting. test jobs are sent without throttling
limitPriority = False
if workQueue.queue_name not in non_rt_wqs \
and nRunning_rt == 0 and (nNotRun_queuelimit + nDefine_queuelimit) > nQueueLimit \
and (totWalltime is None or totWalltime > minTotalWalltime):
limitPriority = True
if not highPrioQueued:
# pilot is not running or DDM has a problem
msgBody = "SKIP no running and enough nQueued_queuelimit({0})>{1} totWalltime({2})>{3} ".format(nNotRun_queuelimit + nDefine_queuelimit,
nQueueLimit, totWalltime, minTotalWalltime)
tmpLog.warning("{0} {1}".format(msgHeader, msgBody))
tmpLog.sendMsg("{0} {1}".format(msgHeader, msgBody),self.msgType, msgLevel='warning', escapeChar=True)
return self.retMergeUnThr
elif workQueue.queue_name in non_rt_wqs \
and nRunning_gs == 0 and (nNotRun_queuelimit + nDefine_queuelimit) > nQueueLimit:
limitPriority = True
if not highPrioQueued:
# pilot is not running or DDM has a problem
msgBody = "SKIP no running and enough nQueued_queuelimit({0})>{1} totWalltime({2})>{3} ".format(nNotRun_queuelimit + nDefine_queuelimit,
nQueueLimit, totWalltime, minTotalWalltime)
tmpLog.warning("{0} {1}".format(msgHeader, msgBody))
tmpLog.sendMsg("{0} {1}".format(msgHeader, msgBody),self.msgType, msgLevel='warning', escapeChar=True)
return self.retMergeUnThr
elif workQueue.queue_name not in non_rt_wqs and nRunning_rt != 0 \
and float(nNotRun_rt + nDefine_rt) / float(nRunning_rt) > threshold and \
(nNotRun_queuelimit + nDefine_queuelimit) > nQueueLimit and (totWalltime is None or totWalltime > minTotalWalltime):
limitPriority = True
if not highPrioQueued:
# enough jobs in Panda
msgBody = "SKIP nQueued_rt({0})/nRunning_rt({1})>{2} & nQueued_queuelimit({3})>{4} totWalltime({5})>{6}".format(nNotRun_rt + nDefine_rt, nRunning_rt,
threshold, nNotRun_queuelimit + nDefine_queuelimit,
nQueueLimit, totWalltime,
minTotalWalltime)
tmpLog.warning("{0} {1}".format(msgHeader, msgBody))
tmpLog.sendMsg("{0} {1}".format(msgHeader, msgBody), self.msgType, msgLevel='warning', escapeChar=True)
return self.retMergeUnThr
elif workQueue.queue_name in non_rt_wqs and nRunning_gs != 0 \
and float(nNotRun_gs + nDefine_gs) / float(nRunning_gs) > threshold and \
(nNotRun_queuelimit + nDefine_queuelimit) > nQueueLimit:
limitPriority = True