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


Python PilotAgentsDB.addPilotTQReference方法代码示例

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


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

示例1: PilotStatusAgent

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

#.........这里部分代码省略.........
    refList = result['Value']

    for pilotRef in refList:
      self.log.info('Setting Waiting pilot to Stalled: %s' % pilotRef)
      result = self.pilotDB.setPilotStatus(pilotRef, 'Stalled', statusReason='Exceeded max waiting time')

    return S_OK()

  def clearParentJob(self, pRef, pDict, connection):
    """ Clear the parameteric parent job from the PilotAgentsDB
    """

    childList = pDict['ChildRefs']

    # Check that at least one child is in the database
    children_ok = False
    for child in childList:
      result = self.pilotDB.getPilotInfo(child, conn=connection)
      if result['OK']:
        if result['Value']:
          children_ok = True

    if children_ok:
      return self.pilotDB.deletePilot(pRef, conn=connection)
    else:
      self.log.verbose('Adding children for parent %s' % pRef)
      result = self.pilotDB.getPilotInfo(pRef)
      parentInfo = result['Value'][pRef]
      tqID = parentInfo['TaskQueueID']
      ownerDN = parentInfo['OwnerDN']
      ownerGroup = parentInfo['OwnerGroup']
      broker = parentInfo['Broker']
      gridType = parentInfo['GridType']
      result = self.pilotDB.addPilotTQReference(childList, tqID, ownerDN, ownerGroup,
                                                broker=broker, gridType=gridType)
      if not result['OK']:
        return result
      children_added = True
      for chRef, chDict in pDict['ChildDicts'].items():
        result = self.pilotDB.setPilotStatus(chRef, chDict['Status'],
                                             destination=chDict['DestinationSite'],
                                             conn=connection)
        if not result['OK']:
          children_added = False
      if children_added:
        result = self.pilotDB.deletePilot(pRef, conn=connection)
      else:
        return S_ERROR('Failed to add children')
    return S_OK()

  def handleOldPilots(self, connection):
    """
      select all pilots that have not been updated in the last N days and declared them
      Deleted, accounting for them.
    """
    pilotsToAccount = {}
    timeLimitToConsider = Time.toString(Time.dateTime() - Time.day * self.pilotStalledDays)
    result = self.pilotDB.selectPilots({'Status': self.queryStateList},
                                       older=timeLimitToConsider,
                                       timeStamp='LastUpdateTime')
    if not result['OK']:
      self.log.error('Failed to get the Pilot Agents')
      return result
    if not result['Value']:
      return S_OK()
开发者ID:DIRACGrid,项目名称:DIRAC,代码行数:69,代码来源:PilotStatusAgent.py

示例2: PilotStatusAgent

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

#.........这里部分代码省略.........
        refList = result["Value"]

        for pilotRef in refList:
            self.log.info("Setting Waiting pilot to Aborted: %s" % pilotRef)
            result = self.pilotDB.setPilotStatus(pilotRef, "Stalled", statusReason="Exceeded max waiting time")

        return S_OK()

    def clearParentJob(self, pRef, pDict, connection):
        """ Clear the parameteric parent job from the PilotAgentsDB
    """

        childList = pDict["ChildRefs"]

        # Check that at least one child is in the database
        children_ok = False
        for child in childList:
            result = self.pilotDB.getPilotInfo(child, conn=connection)
            if result["OK"]:
                if result["Value"]:
                    children_ok = True

        if children_ok:
            return self.pilotDB.deletePilot(pRef, conn=connection)
        else:
            self.log.verbose("Adding children for parent %s" % pRef)
            result = self.pilotDB.getPilotInfo(pRef)
            parentInfo = result["Value"][pRef]
            tqID = parentInfo["TaskQueueID"]
            ownerDN = parentInfo["OwnerDN"]
            ownerGroup = parentInfo["OwnerGroup"]
            broker = parentInfo["Broker"]
            gridType = parentInfo["GridType"]
            result = self.pilotDB.addPilotTQReference(
                childList, tqID, ownerDN, ownerGroup, broker=broker, gridType=gridType
            )
            if not result["OK"]:
                return result
            children_added = True
            for chRef, chDict in pDict["ChildDicts"].items():
                result = self.pilotDB.setPilotStatus(
                    chRef, chDict["Status"], destination=chDict["DestinationSite"], conn=connection
                )
                if not result["OK"]:
                    children_added = False
            if children_added:
                result = self.pilotDB.deletePilot(pRef, conn=connection)
            else:
                return S_ERROR("Failed to add children")
        return S_OK()

    def handleOldPilots(self, connection):
        """
      select all pilots that have not been updated in the last N days and declared them 
      Deleted, accounting for them.
    """
        pilotsToAccount = {}
        timeLimitToConsider = Time.toString(Time.dateTime() - Time.day * self.pilotStalledDays)
        # A.T. Below looks to be a bug
        # result = self.pilotDB.selectPilots( {'Status':self.queryStateList} , older=None, timeStamp='LastUpdateTime' )
        result = self.pilotDB.selectPilots(
            {"Status": self.queryStateList}, older=timeLimitToConsider, timeStamp="LastUpdateTime"
        )
        if not result["OK"]:
            self.log.error("Failed to get the Pilot Agents")
            return result
开发者ID:sposs,项目名称:DIRAC,代码行数:70,代码来源:PilotStatusAgent.py

示例3: PilotStatusAgent

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

#.........这里部分代码省略.........
    refList = result['Value']

    for pilotRef in refList:
      self.log.info( 'Setting Waiting pilot to Aborted: %s' % pilotRef )
      result = self.pilotDB.setPilotStatus( pilotRef, 'Stalled', statusReason = 'Exceeded max waiting time' )

    return S_OK()

  def clearParentJob( self, pRef, pDict, connection ):
    """ Clear the parameteric parent job from the PilotAgentsDB
    """

    childList = pDict['ChildRefs']

    # Check that at least one child is in the database
    children_ok = False
    for child in childList:
      result = self.pilotDB.getPilotInfo( child, conn = connection )
      if result['OK']:
        if result['Value']:
          children_ok = True

    if children_ok:
      return self.pilotDB.deletePilot( pRef, conn = connection )
    else:
      self.log.verbose( 'Adding children for parent %s' % pRef )
      result = self.pilotDB.getPilotInfo( pRef )
      parentInfo = result['Value'][pRef]
      tqID = parentInfo['TaskQueueID']
      ownerDN = parentInfo['OwnerDN']
      ownerGroup = parentInfo['OwnerGroup']
      broker = parentInfo['Broker']
      gridType = parentInfo['GridType']
      result = self.pilotDB.addPilotTQReference( childList, tqID, ownerDN, ownerGroup,
                                                broker = broker, gridType = gridType )
      if not result['OK']:
        return result
      children_added = True
      for chRef, chDict in pDict['ChildDicts'].items():
        result = self.pilotDB.setPilotStatus( chRef, chDict['Status'],
                                             destination = chDict['DestinationSite'],
                                             conn = connection )
        if not result['OK']:
          children_added = False
      if children_added :
        result = self.pilotDB.deletePilot( pRef, conn = connection )
      else:
        return S_ERROR( 'Failed to add children' )
    return S_OK()

  def handleOldPilots( self, connection ):
    """
      select all pilots that have not been updated in the last N days and declared them 
      Deleted, accounting for them.
    """
    pilotsToAccount = {}
    timeLimitToConsider = Time.toString( Time.dateTime() - Time.day * self.pilotStalledDays )
    # A.T. Below looks to be a bug 
    #result = self.pilotDB.selectPilots( {'Status':self.queryStateList} , older=None, timeStamp='LastUpdateTime' )
    result = self.pilotDB.selectPilots( { 'Status':self.queryStateList} ,
                                        older = timeLimitToConsider,
                                        timeStamp = 'LastUpdateTime' )
    if not result['OK']:
      self.log.error( 'Failed to get the Pilot Agents' )
      return result
    if not result['Value']:
开发者ID:cj501885963,项目名称:DIRAC,代码行数:70,代码来源:PilotStatusAgent.py


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