本文整理汇总了Python中DIRAC.WorkloadManagementSystem.DB.JobDB.JobDB.setOptimizerChain方法的典型用法代码示例。如果您正苦于以下问题:Python JobDB.setOptimizerChain方法的具体用法?Python JobDB.setOptimizerChain怎么用?Python JobDB.setOptimizerChain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.WorkloadManagementSystem.DB.JobDB.JobDB
的用法示例。
在下文中一共展示了JobDB.setOptimizerChain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OptimizerModule
# 需要导入模块: from DIRAC.WorkloadManagementSystem.DB.JobDB import JobDB [as 别名]
# 或者: from DIRAC.WorkloadManagementSystem.DB.JobDB.JobDB import setOptimizerChain [as 别名]
#.........这里部分代码省略.........
return S_OK(jobDef)
#############################################################################
def getOptimizerJobInfo(self, job, reportName):
"""This method gets job optimizer information that will
be used for
"""
self.log.verbose("self.jobDB.getJobOptParameter(%s,'%s')" % (job, reportName))
result = self.jobDB.getJobOptParameter(job, reportName)
if result['OK']:
value = result['Value']
if not value:
self.log.warn('JobDB returned null value for %s %s' % (job, reportName))
return S_ERROR('No optimizer info returned')
else:
try:
return S_OK(eval(value))
except BaseException as x:
return S_ERROR('Could not evaluate optimizer parameters: %s' % repr(x))
return result
#############################################################################
def setOptimizerJobInfo(self, job, reportName, value):
"""This method sets the job optimizer information that will subsequently
be used for job scheduling and TURL queries on the WN.
"""
self.log.verbose("self.jobDB.setJobOptParameter(%s,'%s','%s')" % (job, reportName, value))
if not self.am_Enabled():
return S_OK()
return self.jobDB.setJobOptParameter(job, reportName, str(value))
#############################################################################
def setOptimizerChain(self, job, value):
"""This method sets the job optimizer chain, in principle only needed by
one of the optimizers.
"""
self.log.verbose("self.jobDB.setOptimizerChain(%s,%s)" % (job, value))
if not self.am_Enabled():
return S_OK()
return self.jobDB.setOptimizerChain(job, value)
#############################################################################
def setNextOptimizer(self, job):
"""This method is executed when the optimizer instance has successfully
processed the job. The next optimizer in the chain will subsequently
start to work on the job.
"""
result = self.logDB.addLoggingRecord(job, status=self.startingMajorStatus,
minor=self.startingMinorStatus,
source=self.am_getModuleParam("optimizerName"))
if not result['OK']:
self.log.warn(result['Message'])
self.log.verbose("self.jobDB.setNextOptimizer(%s,'%s')" % (job, self.am_getModuleParam("optimizerName")))
return self.jobDB.setNextOptimizer(job, self.am_getModuleParam("optimizerName"))
#############################################################################
def updateJobStatus(self, job, status, minorStatus=None, appStatus=None):
"""This method updates the job status in the JobDB, this should only be
used to fail jobs due to the optimizer chain.
"""
self.log.verbose("self.jobDB.setJobStatus(%s,'Status/Minor/Application','%s'/'%s'/'%s',update=True)" %
(job, status, str(minorStatus), str(appStatus)))
if not self.am_Enabled():