def retrieveThread(optDic,
taskCtrl,
dummy):
"""
"""
info(4,"Entering retrieveThread(%s) ..." % getThreadName())
client = testClient().parseSrvList(optDic["servers"][NGAS_OPT_VAL])
while (1):
nextFileId = taskCtrl.getNextFileId()
if (not nextFileId): thread.exit()
nextFileId = nextFileId[:-1]
info(1,"Next File ID: %s" % nextFileId)
try:
fileSize, fileObj = client.retrieveFileObj(nextFileId)
sizeRemain = fileSize
while (sizeRemain):
if (sizeRemain < BLOCK_SIZE):
reqSize = sizeRemain
else:
reqSize = BLOCK_SIZE
buf = fileObj.read(reqSize)
sizeRemain -= len(buf)
taskCtrl.incBytesRecv(fileSize)
except Exception, e:
error("Error retrieving file with ID: %s - skipping. Error: %s" %\
(nextFileId, str(e)))
评论列表
文章目录