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


Python RequestContainer.getRequestID方法代码示例

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


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

示例1: updateRequest

# 需要导入模块: from DIRAC.RequestManagementSystem.Client.RequestContainer import RequestContainer [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.RequestContainer.RequestContainer import getRequestID [as 别名]
  def updateRequest( self, requestName, requestString ):
    """ update request given its name and xml serilised string

    :param str requestName: Requests.RequestName
    :param str requestString: request serilised to xml
    """
    request = RequestContainer( request = requestString )
    requestTypes = ['transfer', 'register', 'removal', 'stage', 'diset', 'logupload']
    requestID = request.getRequestID()['Value']
    updateRequestFailed = False
    for requestType in requestTypes:
      res = request.getNumSubRequests( requestType )
      if res['OK']:
        numRequests = res['Value']
        for ind in range( numRequests ):
          res = request.getSubRequestAttributes( ind, requestType )
          if res['OK']:
            subRequestDict = res['Value']
            if 'SubRequestID' in subRequestDict:
              subRequestID = res['Value']['SubRequestID']
              res = self.__updateSubRequestFiles( ind, requestType, subRequestID, request )
              if res['OK']:
                if request.isSubRequestDone( ind, requestType )['Value']:
                  res = self._setSubRequestAttribute( requestID, subRequestID, 'Status', 'Done' )
                else:
                  res = self._setSubRequestAttribute( requestID, subRequestID, 'Status', 'Waiting' )
                if not res['OK']:
                  updateRequestFailed = True
              else:
                updateRequestFailed = True
              if "Error" in subRequestDict:
                result = self._setSubRequestAttribute( requestID, subRequestID, 
                                                       'Error', subRequestDict['Error'] )
                if not result['OK']:
                  updateRequestFailed = True
            else:
              updateRequestFailed = True
          else:
            updateRequestFailed = True
      else:
        updateRequestFailed = True
    if updateRequestFailed:
      errStr = 'Failed to update request %s.' % requestID
      return S_ERROR( errStr )
    else:
      requestStatus = self.getRequestStatus( requestID )
      if not requestStatus["OK"]:
        return requestStatus
      requestStatus = requestStatus["Value"]
      if requestStatus["SubRequestStatus"] not in ( "Waiting", "Assigned" ):
        res = self._setRequestAttribute( requestID, 'Status', 'Done' )
        if not res['OK']:
          errStr = 'Failed to update request status of %s to Done.' % requestID
          return S_ERROR( errStr )

      return S_OK()
开发者ID:sbel,项目名称:bes3-jinr,代码行数:58,代码来源:RequestDBMySQL.py

示例2: updateRequest

# 需要导入模块: from DIRAC.RequestManagementSystem.Client.RequestContainer import RequestContainer [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.RequestContainer.RequestContainer import getRequestID [as 别名]
 def updateRequest( self, requestName, requestString ):
   request = RequestContainer( request = requestString )
   requestTypes = ['transfer', 'register', 'removal', 'stage', 'diset', 'logupload']
   requestID = request.getRequestID()['Value']
   updateRequestFailed = False
   for requestType in requestTypes:
     res = request.getNumSubRequests( requestType )
     if res['OK']:
       numRequests = res['Value']
       for ind in range( numRequests ):
         res = request.getSubRequestAttributes( ind, requestType )
         if res['OK']:
           subRequestDict = res['Value']
           if 'SubRequestID' in subRequestDict:
             subRequestID = res['Value']['SubRequestID']
             res = self.__updateSubRequestFiles( ind, requestType, subRequestID, request )
             if res['OK']:
               if request.isSubRequestDone( ind, requestType )['Value']:
                 res = self._setSubRequestAttribute( requestID, subRequestID, 'Status', 'Done' )
               else:
                 res = self._setSubRequestAttribute( requestID, subRequestID, 'Status', 'Waiting' )
               if not res['OK']:
                 updateRequestFailed = True
             else:
               updateRequestFailed = True
             if "Error" in subRequestDict:
               result = self._setSubRequestAttribute( requestID, subRequestID, 'Error', subRequestDict['Error'] )
               if not result['OK']:
                 updateRequestFailed = True
           else:
             updateRequestFailed = True
         else:
           updateRequestFailed = True
     else:
       updateRequestFailed = True
   if updateRequestFailed:
     errStr = 'Failed to update request %s.' % requestID
     return S_ERROR( errStr )
   else:
     if request.isRequestDone()['Value']:
       res = self._setRequestAttribute( requestID, 'Status', 'Done' )
       if not res['OK']:
         errStr = 'Failed to update request status of %s to Done.' % requestID
         return S_ERROR( errStr )
     return S_OK()
开发者ID:caitriana,项目名称:DIRAC,代码行数:47,代码来源:RequestDBMySQL.py


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