本文整理汇总了Python中DIRAC.Core.DISET.private.FileHelper.FileHelper.finishedTransmission方法的典型用法代码示例。如果您正苦于以下问题:Python FileHelper.finishedTransmission方法的具体用法?Python FileHelper.finishedTransmission怎么用?Python FileHelper.finishedTransmission使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.Core.DISET.private.FileHelper.FileHelper
的用法示例。
在下文中一共展示了FileHelper.finishedTransmission方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __doFileTransfer
# 需要导入模块: from DIRAC.Core.DISET.private.FileHelper import FileHelper [as 别名]
# 或者: from DIRAC.Core.DISET.private.FileHelper.FileHelper import finishedTransmission [as 别名]
def __doFileTransfer(self, sDirection):
"""
Execute a file transfer action
@type sDirection: string
@param sDirection: Direction of the transfer
@return: S_OK/S_ERROR
"""
retVal = self.__trPool.receive(self.__trid)
if not retVal["OK"]:
raise RequestHandler.ConnectionError(
"Error while receiving file description %s %s"
% (self.srv_getFormattedRemoteCredentials(), retVal["Message"])
)
fileInfo = retVal["Value"]
sDirection = "%s%s" % (sDirection[0].lower(), sDirection[1:])
if "transfer_%s" % sDirection not in dir(self):
self.__trPool.send(self.__trid, S_ERROR("Service can't transfer files %s" % sDirection))
return
retVal = self.__trPool.send(self.__trid, S_OK("Accepted"))
if not retVal["OK"]:
return retVal
self.__logRemoteQuery("FileTransfer/%s" % sDirection, fileInfo)
self.__lockManager.lock(sDirection)
try:
try:
fileHelper = FileHelper(self.__trPool.get(self.__trid))
if sDirection == "fromClient":
fileHelper.setDirection("fromClient")
uRetVal = self.transfer_fromClient(fileInfo[0], fileInfo[1], fileInfo[2], fileHelper)
elif sDirection == "toClient":
fileHelper.setDirection("toClient")
uRetVal = self.transfer_toClient(fileInfo[0], fileInfo[1], fileHelper)
elif sDirection == "bulkFromClient":
fileHelper.setDirection("fromClient")
uRetVal = self.transfer_bulkFromClient(fileInfo[0], fileInfo[1], fileInfo[2], fileHelper)
elif sDirection == "bulkToClient":
fileHelper.setDirection("toClient")
uRetVal = self.transfer_bulkToClient(fileInfo[0], fileInfo[1], fileHelper)
elif sDirection == "listBulk":
fileHelper.setDirection("toClient")
uRetVal = self.transfer_listBulk(fileInfo[0], fileInfo[1], fileHelper)
else:
return S_ERROR("Direction %s does not exist!!!" % sDirection)
if uRetVal["OK"] and not fileHelper.finishedTransmission():
gLogger.error("You haven't finished receiving/sending the file", str(fileInfo))
return S_ERROR("Incomplete transfer")
return uRetVal
finally:
self.__lockManager.unlock(sDirection)
except Exception, v:
gLogger.exception("Uncaught exception when serving Transfer", "%s" % sDirection)
return S_ERROR("Server error while serving %s: %s" % (sDirection, str(v)))