當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。