本文整理汇总了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()
示例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()