当前位置: 首页>>代码示例>>Python>>正文


Python JobDB.setJobParameter方法代码示例

本文整理汇总了Python中DIRAC.WorkloadManagementSystem.DB.JobDB.JobDB.setJobParameter方法的典型用法代码示例。如果您正苦于以下问题:Python JobDB.setJobParameter方法的具体用法?Python JobDB.setJobParameter怎么用?Python JobDB.setJobParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DIRAC.WorkloadManagementSystem.DB.JobDB.JobDB的用法示例。


在下文中一共展示了JobDB.setJobParameter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: OptimizerModule

# 需要导入模块: from DIRAC.WorkloadManagementSystem.DB.JobDB import JobDB [as 别名]
# 或者: from DIRAC.WorkloadManagementSystem.DB.JobDB.JobDB import setJobParameter [as 别名]

#.........这里部分代码省略.........
                                         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():
      return S_OK()

    result = self.jobDB.setJobStatus(job, status, minorStatus, appStatus)
    if not result['OK']:
      return result

    result = self.logDB.addLoggingRecord(job, status=status, minor=minorStatus, application=appStatus,
                                         source=self.am_getModuleParam('optimizerName'))
    if not result['OK']:
      self.log.warn(result['Message'])

    return S_OK()

  #############################################################################
  def setJobParam(self, job, reportName, value):
    """This method updates a job parameter in the JobDB.
    """
    self.log.verbose("self.jobDB.setJobParameter(%s,'%s','%s')" % (job, reportName, value))
    if not self.am_Enabled():
      return S_OK()
    return self.jobDB.setJobParameter(job, reportName, value)

  #############################################################################
  def setFailedJob(self, job, msg, classAdJob=None):
    """This method moves the job to the failed status
    """
    self.log.verbose("self.updateJobStatus(%s,'%s','%s')" % (job, self.failedStatus, msg))
    if not self.am_Enabled():
      return S_OK()
    self.updateJobStatus(job, self.failedStatus, msg)
    if classAdJob:
      self.sendAccountingRecord(job, msg, classAdJob)

  #############################################################################
  def checkJob(self, job, classad):
    """This method controls the checking of the job, should be overridden in a subclass
    """
    self.log.warn('Optimizer: checkJob method should be implemented in a subclass')
    return S_ERROR('Optimizer: checkJob method should be implemented in a subclass')

  #############################################################################
  def sendAccountingRecord(self, job, msg, classAdJob):
    """
      Send and accounting record for the failed job
    """
    accountingReport = AccountingJob()
    accountingReport.setStartTime()
    accountingReport.setEndTime()

    owner = classAdJob.getAttributeString('Owner')
开发者ID:DIRACGrid,项目名称:DIRAC,代码行数:70,代码来源:OptimizerModule.py


注:本文中的DIRAC.WorkloadManagementSystem.DB.JobDB.JobDB.setJobParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。