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


Python moto.mock_emr方法代码示例

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


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

示例1: emr

# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_emr [as 别名]
def emr():
    """EMR mock service"""
    # FIXME: moto can only support us-east-1 when EMR module is used
    # https://github.com/spulec/moto/pull/456
    # https://github.com/spulec/moto/pull/375
    mock = mock_emr()
    mock.start()
    client = boto3.client('emr')
    clusters = []
    for i in range(2):
        cluster = client.run_job_flow(
            Name='cluster-{:02d}'.format(i),
            Instances={
                'MasterInstanceType': 'c3.xlarge',
                'SlaveInstanceType': 'c3.xlarge',
                'InstanceCount': 3,
                'Placement': {'AvailabilityZone': 'us-east-1'},
                'KeepJobFlowAliveWhenNoSteps': True,
            },
            VisibleToAllUsers=True,
        )
        clusters.append(cluster)
    yield {'clusters': clusters}
    mock.stop() 
开发者ID:achiku,项目名称:jungle,代码行数:26,代码来源:conftest.py

示例2: moto_emr

# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_emr [as 别名]
def moto_emr():
    with moto.mock_emr():
        yield True 
开发者ID:awslabs,项目名称:aws-data-wrangler,代码行数:5,代码来源:test_moto.py

示例3: emr_client

# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_emr [as 别名]
def emr_client(aws_credentials):
    with mock_emr():
        yield boto3.client('emr', region_name='us-east-1') 
开发者ID:jwplayer,项目名称:sparksteps,代码行数:5,代码来源:test_poll.py

示例4: test_wait_for_step_complete

# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_emr [as 别名]
def test_wait_for_step_complete():
    """
    Ensure polling.poll is called with expected arguments
    """
    with patch('sparksteps.poll.poll') as mock_poll:
        mock_emr = MagicMock()
        jobflow_id = 'fake-jobflow-id'
        step_id = 'fake-step-id'
        wait_for_step_complete(mock_emr, jobflow_id, step_id, 1)
        mock_poll.assert_called_once_with(
            is_step_complete, args=(mock_emr, jobflow_id, step_id), step=1, poll_forever=True) 
开发者ID:jwplayer,项目名称:sparksteps,代码行数:13,代码来源:test_poll.py

示例5: test_class

# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_emr [as 别名]
def test_class(self):
        with moto.mock_emr():
            whitelist = {}
            settings = {
                "general": {"dry_run": False},
                "services": {"emr": {"clusters": {"clean": True, "ttl": -1}}},
            }
            resource_tree = {"AWS": {}}

            test_class = emr_cleanup.EMRCleanup(
                logging, whitelist, settings, resource_tree, "ap-southeast-2"
            )
            yield test_class 
开发者ID:servian,项目名称:aws-auto-cleanup,代码行数:15,代码来源:test_emr.py


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