當前位置: 首頁>>代碼示例>>Python>>正文


Python DBSBufferUtil.loadBlocks方法代碼示例

本文整理匯總了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)
開發者ID:DAMason,項目名稱:WMCore,代碼行數:70,代碼來源:DBSUploadPoller.py


注:本文中的WMComponent.DBS3Buffer.DBSBufferUtil.DBSBufferUtil.loadBlocks方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。