本文整理汇总了Python中WMComponent.DBS3Buffer.DBSBufferUtil.DBSBufferUtil.loadBlocks方法的典型用法代码示例。如果您正苦于以下问题:Python DBSBufferUtil.loadBlocks方法的具体用法?Python DBSBufferUtil.loadBlocks怎么用?Python DBSBufferUtil.loadBlocks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMComponent.DBS3Buffer.DBSBufferUtil.DBSBufferUtil
的用法示例。
在下文中一共展示了DBSBufferUtil.loadBlocks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DBSUploadPoller
# 需要导入模块: from WMComponent.DBS3Buffer.DBSBufferUtil import DBSBufferUtil [as 别名]
# 或者: from WMComponent.DBS3Buffer.DBSBufferUtil.DBSBufferUtil import loadBlocks [as 别名]
#.........这里部分代码省略.........
if terminate:
proc.terminate()
else:
proc.join()
self.pool = []
self.workInput = None
self.workResult = None
return
def terminate(self, params):
"""
Do one more pass, then terminate
"""
logging.debug("terminating. doing one more pass before we die")
self.algorithm(params)
@timeFunction
def algorithm(self, parameters=None):
"""
_algorithm_
First, check blocks that may be already uploaded
Then, load blocks
Then, load files
Then, move files into blocks
Then add new blocks in DBSBuffer
Then add blocks to DBS
Then mark blocks as done in DBSBuffer
"""
try:
logging.info("Starting the DBSUpload Polling Cycle")
self.checkBlocks()
self.loadBlocks()
self.loadFiles()
self.checkBlockCompletion()
self.inputBlocks()
self.retrieveBlocks()
except WMException:
raise
except Exception as ex:
msg = "Unhandled Exception in DBSUploadPoller!\n"
msg += str(ex)
msg += str(str(traceback.format_exc()))
logging.error(msg)
raise DBSUploadException(msg)
def loadBlocks(self):
"""
_loadBlocks_
Find all blocks; make sure they're in the cache
"""
openBlocks = self.dbsUtil.findOpenBlocks()
logging.info("Found %d open blocks.", len(openBlocks))
logging.debug("These are the openblocks: %s", openBlocks)
# Load them if we don't have them
blocksToLoad = []
for block in openBlocks:
if not block['blockname'] in self.blockCache.keys():
blocksToLoad.append(block['blockname'])
# Now load the blocks
try:
loadedBlocks = self.dbsUtil.loadBlocks(blocksToLoad)