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


Python blockdevicemapping.BlockDeviceType方法代码示例

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


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

示例1: _getBlockDeviceMapping

# 需要导入模块: from boto.ec2 import blockdevicemapping [as 别名]
# 或者: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
def _getBlockDeviceMapping(cls, instanceType, rootVolSize=50):
        # determine number of ephemeral drives via cgcloud-lib (actually this is moved into toil's lib
        bdtKeys = [''] + ['/dev/xvd{}'.format(c) for c in string.ascii_lowercase[1:]]
        bdm = BlockDeviceMapping()
        # Change root volume size to allow for bigger Docker instances
        root_vol = BlockDeviceType(delete_on_termination=True)
        root_vol.size = rootVolSize
        bdm["/dev/xvda"] = root_vol
        # The first disk is already attached for us so start with 2nd.
        # Disk count is weirdly a float in our instance database, so make it an int here.
        for disk in range(1, int(instanceType.disks) + 1):
            bdm[bdtKeys[disk]] = BlockDeviceType(
                ephemeral_name='ephemeral{}'.format(disk - 1))  # ephemeral counts start at 0

        logger.debug('Device mapping: %s', bdm)
        return bdm 
开发者ID:DataBiosphere,项目名称:toil,代码行数:18,代码来源:awsProvisioner.py

示例2: launchCluster

# 需要导入模块: from boto.ec2 import blockdevicemapping [as 别名]
# 或者: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
def launchCluster(self):
        from toil.lib.ec2 import wait_instances_running
        from boto.ec2.blockdevicemapping import BlockDeviceType
        self.createClusterUtil(args=['--leaderStorage', str(self.requestedLeaderStorage),
                                     '--nodeTypes', ",".join(self.instanceTypes), '-w', ",".join(self.numWorkers), '--nodeStorage', str(self.requestedLeaderStorage)])

        self.cluster = clusterFactory(provisioner='aws', clusterName=self.clusterName)
        nodes = self.cluster._getNodesInCluster(both=True)
        nodes.sort(key=lambda x: x.launch_time)
        # assuming that leader is first
        workers = nodes[1:]
        # test that two worker nodes were created
        self.assertEqual(2, len(workers))
        # test that workers have expected storage size
        # just use the first worker
        worker = workers[0]
        worker = next(wait_instances_running(self.cluster._ctx.ec2, [worker]))
        rootBlockDevice = worker.block_device_mapping["/dev/xvda"]
        self.assertTrue(isinstance(rootBlockDevice, BlockDeviceType))
        rootVolume = self.cluster._ctx.ec2.get_all_volumes(volume_ids=[rootBlockDevice.volume_id])[0]
        self.assertGreaterEqual(rootVolume.size, self.requestedNodeStorage) 
开发者ID:DataBiosphere,项目名称:toil,代码行数:23,代码来源:awsProvisionerTest.py

示例3: getRootVolID

# 需要导入模块: from boto.ec2 import blockdevicemapping [as 别名]
# 或者: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
def getRootVolID(self):
        instances = self.cluster._getNodesInCluster(nodeType=None, both=True)
        instances.sort(key=lambda x: x.launch_time)
        leader = instances[0]  # assume leader was launched first

        from boto.ec2.blockdevicemapping import BlockDeviceType
        rootBlockDevice = leader.block_device_mapping["/dev/xvda"]
        assert isinstance(rootBlockDevice, BlockDeviceType)
        return rootBlockDevice.volume_id 
开发者ID:DataBiosphere,项目名称:toil,代码行数:11,代码来源:awsProvisionerTest.py


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