本文整理汇总了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()
示例2: moto_emr
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_emr [as 别名]
def moto_emr():
with moto.mock_emr():
yield True
示例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')
示例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)
示例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