当前位置: 首页>>代码示例>>Python>>正文


Python DataBlockGenerator.getDataset方法代码示例

本文整理汇总了Python中WMQuality.Emulators.DataBlockGenerator.DataBlockGenerator.DataBlockGenerator.getDataset方法的典型用法代码示例。如果您正苦于以下问题:Python DataBlockGenerator.getDataset方法的具体用法?Python DataBlockGenerator.getDataset怎么用?Python DataBlockGenerator.getDataset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WMQuality.Emulators.DataBlockGenerator.DataBlockGenerator.DataBlockGenerator的用法示例。


在下文中一共展示了DataBlockGenerator.getDataset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from WMQuality.Emulators.DataBlockGenerator.DataBlockGenerator import DataBlockGenerator [as 别名]
# 或者: from WMQuality.Emulators.DataBlockGenerator.DataBlockGenerator.DataBlockGenerator import getDataset [as 别名]
class PhEDEx:
    """
    """
    def __init__(self, *args, **kwargs):
        print "Using PhEDEx Emulator ...."
        self.dataBlocks = DataBlockGenerator()

    def getReplicaInfoForBlocks(self, **args):
        """
        Where are blocks located
        """
        for block in args['block']:
            data = {"phedex":{"request_timestamp":1254762796.13538, "block" : []}}
            blocks = data['phedex']['block']
            files = self.dataBlocks.getFiles(block)
            locations = self.dataBlocks.getLocation(block)
            blocks.append({"files": len(files), "name": block,
                           'replica' : [{'se' : x } for x in locations]})
        return data

    def subscriptions(self, **args):
        """
        Where is data subscribed - for now just replicate blockreplicas
        """
        data = {'phedex' : {"request_timestamp" : 1254850198.15418,
                            'dataset' : []}}
        # different structure depending on whether we ask for dataset or blocks
        
        if args.has_key('dataset') and args['dataset']:
            for dataset in args['dataset']:
                # TODO needs to add correct file numbers
                data['phedex']['dataset'].append({'name' : dataset, 'files' : 5,
                                                  'subscription' : []})
                subs = data['phedex']['dataset'][-1]['subscription']
                    #FIXME: Take from self.locations
                subs.append({'node': 'SiteA', 'custodial': 'n', 'suspend_until': None,
                             'level': 'dataset', 'move': 'n', 'request': '47983',
                             'time_created': '1232989000', 'priority': 'low',
                             'time_update': None, 'node_id': '781',
                             'suspended': 'n', 'group': None})
            return data
        elif args.has_key('block') and args['block']:
            
            for block in args['block']:
                dataset = self.dataBlocks.getDataset('block')
                # TODO needs to add correct file numbers
                data['phedex']['dataset'].append({'name' : dataset, 'files' : 5,
                                              'block' : []})
                blocks = data['phedex']['dataset'][-1]['block']
                locations= self.dataBlocks.getLocation(block)
                        
                blocks.append({"bytes":"10438786614", "files":"5", "is_open":"n",
                               "name": args['block'],
                               "id":"454370", "subscription"
                                                  :[ {'node' : x } for x in locations]
                                                        #{"priority":"normal", "request":"51253", "time_created":"1245165314",
                                                        #   "move":"n", "suspend_until":None, "node":"SiteA",
                                                        #   "time_update":"1228905272", "group":None, "level":"block",
                                                        #   "node_id":"641", "custodial":"n", "suspended":"n"}]
                                                    })
            return data
        
    def emulator(self):
        return "PhEDEx emulator ...."
开发者ID:PerilousApricot,项目名称:CRAB2,代码行数:66,代码来源:PhEDEx.py


注:本文中的WMQuality.Emulators.DataBlockGenerator.DataBlockGenerator.DataBlockGenerator.getDataset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。