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


Python DataBlockGenerator._blockGenerator方法代碼示例

本文整理匯總了Python中WMQuality.Emulators.DataBlockGenerator.DataBlockGenerator.DataBlockGenerator._blockGenerator方法的典型用法代碼示例。如果您正苦於以下問題:Python DataBlockGenerator._blockGenerator方法的具體用法?Python DataBlockGenerator._blockGenerator怎麽用?Python DataBlockGenerator._blockGenerator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WMQuality.Emulators.DataBlockGenerator.DataBlockGenerator.DataBlockGenerator的用法示例。


在下文中一共展示了DataBlockGenerator._blockGenerator方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: PhEDEx

# 需要導入模塊: from WMQuality.Emulators.DataBlockGenerator.DataBlockGenerator import DataBlockGenerator [as 別名]
# 或者: from WMQuality.Emulators.DataBlockGenerator.DataBlockGenerator.DataBlockGenerator import _blockGenerator [as 別名]

#.........這裏部分代碼省略.........
                                               "id" : 5})
        nodeMappings["phedex"]["node"].append({"name" : "T1_UK_RAL_Buffer",
                                               "kind" : "Buffer",
                                               "se"   : "srm-cms.gridpp.rl.ac.uk",
                                               "technology" : "Castor",
                                               "id" : 6})
        nodeMappings["phedex"]["node"].append({"name" : "T1_UK_RAL_Disk",
                                               "kind" : "Disk",
                                               "se"   : "srm-cms-disk.gridpp.rl.ac.uk",
                                               "technology" : "Disk",
                                               "id" : 7})
        nodeMappings["phedex"]["node"].append({"name" : "T2_CH_CERN",
                                               "kind" : "Disk",
                                               "se"   : "srm-eoscms.cern.ch",
                                               "technology" : "Disk",
                                               "id" : 8})
        nodeMappings["phedex"]["node"].append({"name" : "T3_CO_Uniandes",
                                               "kind" : "Disk",
                                               "se"   : "moboro.uniandes.edu.co",
                                               "technology" : "DPM",
                                               "id" : 9})
        return nodeMappings

    def getReplicaInfoForBlocks(self, **args):
        """
        Where are blocks located
        """
        data = {"phedex":{"request_timestamp":1254762796.13538, "block" : []}}
        if 'dataset' in args:
            args['block'] = []
            if type(args['dataset']) != type([]):
                args['dataset'] = [args['dataset']]
            for dataset in args['dataset']:
                args['block'].extend(self.dataBlocks._blockGenerator(dataset))
            args['block'] = [x['Name'] for x in args['block']]
        for block in args['block']:
            blocks = data['phedex']['block']
            files = self.dataBlocks.getFiles(block)
            locations = self.dataBlocks.getLocation(block)
            blocks.append({"files": len(files), "name": block,
                           'replica' : [{'node' : x + '_MSS' } for x in locations]})
        return data

    def subscriptions(self, **args):
        """
        Where is data subscribed - for now just replicate blockreplicas
        """
        def _blockInfoGenerator(blockList):

            for block in blockList:
                if type(block) == dict:
                    block = block['Name']
                dataset = self.dataBlocks.getDatasetName(block)
                # TODO needs to add correct file numbers
                datasetList = data['phedex']['dataset']
                if datasetList:
                    find = False
                    for dataItem in datasetList:
                        if dataItem['name'] == dataset:
                            datasetSelected = dataItem
                            find = True
                            break
                if not(datasetList and find):
                    data['phedex']['dataset'].append({'name' : dataset, 'files' : filesInDataset,
                                                      'block' : []})
開發者ID:mialiu149,項目名稱:WMCore,代碼行數:69,代碼來源:PhEDEx.py


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