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


Python MesosSchedulerDriver._stream_id方法代码示例

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


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

示例1: test_reconcile_operations

# 需要导入模块: from pymesos import MesosSchedulerDriver [as 别名]
# 或者: from pymesos.MesosSchedulerDriver import _stream_id [as 别名]
def test_reconcile_operations(mocker):
    ID = str(uuid.uuid4())
    sched = mocker.Mock()
    framework = {'id': {'value': ID}}
    master = mocker.Mock()
    driver = MesosSchedulerDriver(sched, framework, master)
    driver._send = mocker.Mock()
    op_ids = [str(uuid.uuid4()) for _ in range(random.randint(1, 10))]
    operations = [
        {
            'operation_id': {
                'value': id
            }
        }
        for id in op_ids
    ]
    driver.reconcileOperations(operations)
    driver._send.assert_not_called()
    driver._stream_id = 'a-stream-id'
    driver.reconcileOperations(operations)
    driver._send.assert_called_once_with({
        'type': 'RECONCILE_OPERATIONS',
        'framework_id': {
            'value': ID
        },
        'reconcile_operations': {
            'operations': operations
        }
    })
开发者ID:douban,项目名称:pymesos,代码行数:31,代码来源:test_scheduler.py

示例2: test_accept_offers

# 需要导入模块: from pymesos import MesosSchedulerDriver [as 别名]
# 或者: from pymesos.MesosSchedulerDriver import _stream_id [as 别名]
def test_accept_offers(mocker):
    ID = str(uuid.uuid4())
    sched = mocker.Mock()
    framework = {'id': {'value': ID}}
    master = mocker.Mock()
    driver = MesosSchedulerDriver(sched, framework, master)
    driver._send = mocker.Mock()
    offer_ids = [str(uuid.uuid4()) for _ in range(random.randint(1, 10))]
    operations = [{
        'type': 'LAUNCH',
        'launch': {
            'task_infos': [
                {
                    'name': '1',
                },
                {
                    'name': '2',
                }
            ]
        }
    }]
    driver.acceptOffers(offer_ids, operations)
    driver._send.assert_not_called()
    driver._stream_id = 'a-stream-id'
    driver.acceptOffers(offer_ids, operations)
    driver._send.assert_called_once_with({
        'type': 'ACCEPT',
        'framework_id': {
            'value': ID
        },
        'accept': {
            'offer_ids': offer_ids,
            'operations': operations,
        }
    })
开发者ID:douban,项目名称:pymesos,代码行数:37,代码来源:test_scheduler.py

示例3: test_send_framework_message

# 需要导入模块: from pymesos import MesosSchedulerDriver [as 别名]
# 或者: from pymesos.MesosSchedulerDriver import _stream_id [as 别名]
def test_send_framework_message(mocker):
    ID = str(uuid.uuid4())
    sched = mocker.Mock()
    framework = {'id': {'value': ID}}
    master = mocker.Mock()
    driver = MesosSchedulerDriver(sched, framework, master)
    driver._send = mocker.Mock()
    executor_id = {'value': str(uuid.uuid4())}
    agent_id = {'value': str(uuid.uuid4())}
    message = ''.join(random.choice(string.printable)
                      for _ in range(random.randint(1, 100)))
    message = encode_data(message.encode('utf-8'))
    driver.sendFrameworkMessage(executor_id, agent_id, message)
    driver._send.assert_not_called()
    driver._stream_id = 'a-stream-id'
    driver.sendFrameworkMessage(executor_id, agent_id, message)
    driver._send.assert_called_once_with({
        'type': 'MESSAGE',
        'framework_id': {
            'value': ID
        },
        'message': {
            'agent_id': agent_id,
            'executor_id': executor_id,
            'data': message,
        }
    })
开发者ID:douban,项目名称:pymesos,代码行数:29,代码来源:test_scheduler.py

示例4: test_reconcile_tasks

# 需要导入模块: from pymesos import MesosSchedulerDriver [as 别名]
# 或者: from pymesos.MesosSchedulerDriver import _stream_id [as 别名]
def test_reconcile_tasks(mocker):
    ID = str(uuid.uuid4())
    sched = mocker.Mock()
    framework = {'id': {'value': ID}}
    master = mocker.Mock()
    driver = MesosSchedulerDriver(sched, framework, master)
    driver._send = mocker.Mock()
    task_ids = [str(uuid.uuid4()) for _ in range(random.randint(1, 10))]
    tasks = [
        {
            'task_id': {
                'value': id
            }
        }
        for id in task_ids
    ]
    driver.reconcileTasks(tasks)
    driver._send.assert_not_called()
    driver._stream_id = 'a-stream-id'
    driver.reconcileTasks(tasks)
    driver._send.assert_called_once_with({
        'type': 'RECONCILE',
        'framework_id': {
            'value': ID
        },
        'reconcile': {
            'tasks': tasks
        }
    })
开发者ID:douban,项目名称:pymesos,代码行数:31,代码来源:test_scheduler.py

示例5: test_acknowledge_operation_status_update

# 需要导入模块: from pymesos import MesosSchedulerDriver [as 别名]
# 或者: from pymesos.MesosSchedulerDriver import _stream_id [as 别名]
def test_acknowledge_operation_status_update(mocker):
    ID = str(uuid.uuid4())
    sched = mocker.Mock()
    framework = {'id': {'value': ID}}
    master = mocker.Mock()
    driver = MesosSchedulerDriver(sched, framework, master)
    driver._send = mocker.Mock()
    agent_id = dict(value=str(uuid.uuid4()))
    operation_id = dict(value=str(uuid.uuid4()))
    uid = encode_data(uuid.uuid4().bytes)
    status = {
        'agent_id': agent_id,
        'operation_id': operation_id,
        'uuid': uid
    }
    driver.acknowledgeOperationStatusUpdate(status)
    driver._send.assert_not_called()
    driver._stream_id = 'a-stream-id'
    driver.acknowledgeOperationStatusUpdate(status)
    driver._send.assert_called_once_with({
        'type': 'ACKNOWLEDGE_OPERATION_STATUS',
        'framework_id': {
            'value': ID
        },
        'acknowledge_operation_status': {
            'agent_id': agent_id,
            'operation_id': operation_id,
            'uuid': uid,
        }
    })
开发者ID:douban,项目名称:pymesos,代码行数:32,代码来源:test_scheduler.py

示例6: test_revive_offers

# 需要导入模块: from pymesos import MesosSchedulerDriver [as 别名]
# 或者: from pymesos.MesosSchedulerDriver import _stream_id [as 别名]
def test_revive_offers(mocker):
    ID = str(uuid.uuid4())
    sched = mocker.Mock()
    framework = {'id': {'value': ID}}
    master = mocker.Mock()
    driver = MesosSchedulerDriver(sched, framework, master)
    driver._send = mocker.Mock()
    driver._stream_id = str(uuid.uuid4())
    driver.reviveOffers()
    driver._send.assert_called_once_with({
        'type': 'REVIVE',
        'framework_id': {
            'value': ID
        },
    })
开发者ID:windreamer,项目名称:pymesos,代码行数:17,代码来源:test_scheduler.py

示例7: test_kill_task

# 需要导入模块: from pymesos import MesosSchedulerDriver [as 别名]
# 或者: from pymesos.MesosSchedulerDriver import _stream_id [as 别名]
def test_kill_task(mocker):
    ID = str(uuid.uuid4())
    sched = mocker.Mock()
    framework = {'id': {'value': ID}}
    master = mocker.Mock()
    driver = MesosSchedulerDriver(sched, framework, master)
    driver._send = mocker.Mock()
    driver.killTask({"value": "my-task"})
    driver._send.assert_not_called()
    driver._stream_id = str(uuid.uuid4())
    driver.killTask({"value": "my-task"})
    driver._send.assert_called_once_with({
        'type': 'KILL',
        'framework_id': {'value': ID},
        'kill': {
            'task_id': {'value': 'my-task'},
        }
    })
开发者ID:douban,项目名称:pymesos,代码行数:20,代码来源:test_scheduler.py

示例8: test_suppress_offers_roles

# 需要导入模块: from pymesos import MesosSchedulerDriver [as 别名]
# 或者: from pymesos.MesosSchedulerDriver import _stream_id [as 别名]
def test_suppress_offers_roles(mocker):
    ID = str(uuid.uuid4())
    sched = mocker.Mock()
    framework = {'id': {'value': ID}}
    master = mocker.Mock()
    driver = MesosSchedulerDriver(sched, framework, master)
    driver._send = mocker.Mock()
    driver._stream_id = str(uuid.uuid4())
    driver.suppressOffers(['role1', 'role2'])
    driver._send.assert_called_once_with({
        'type': 'SUPPRESS',
        'framework_id': {
            'value': ID
        },
        'suppress': {
            'roles': ['role1', 'role2']
        }
    })
开发者ID:douban,项目名称:pymesos,代码行数:20,代码来源:test_scheduler.py

示例9: test_decline_inverse_offer

# 需要导入模块: from pymesos import MesosSchedulerDriver [as 别名]
# 或者: from pymesos.MesosSchedulerDriver import _stream_id [as 别名]
def test_decline_inverse_offer(mocker):
    ID = str(uuid.uuid4())
    sched = mocker.Mock()
    framework = {'id': {'value': ID}}
    master = mocker.Mock()
    driver = MesosSchedulerDriver(sched, framework, master)
    driver._send = mocker.Mock()
    offer_ids = [str(uuid.uuid4()) for _ in range(random.randint(1, 10))]
    driver.declineInverseOffer(offer_ids)
    driver._send.assert_not_called()
    driver._stream_id = 'a-stream-id'
    driver.declineInverseOffer(offer_ids)
    driver._send.assert_called_once_with({
        'type': 'DECLINE_INVERSE_OFFERS',
        'framework_id': {
            'value': ID
        },
        'decline_inverse_offers': {
            'inverse_offer_ids': offer_ids
        }
    })
开发者ID:douban,项目名称:pymesos,代码行数:23,代码来源:test_scheduler.py

示例10: test_request_resources

# 需要导入模块: from pymesos import MesosSchedulerDriver [as 别名]
# 或者: from pymesos.MesosSchedulerDriver import _stream_id [as 别名]
def test_request_resources(mocker):
    ID = str(uuid.uuid4())
    sched = mocker.Mock()
    framework = {'id': {'value': ID}}
    master = mocker.Mock()
    driver = MesosSchedulerDriver(sched, framework, master)
    driver._send = mocker.Mock()
    requests = [{
        'agent_id': {'value': str(uuid.uuid4())},
        'resources': {}
    } for _ in range(random.randint(1, 10))]
    driver.requestResources(requests)
    driver._send.assert_not_called()
    driver._stream_id = 'a-stream-id'
    driver.requestResources(requests)
    driver._send.assert_called_once_with({
        'type': 'REQUEST',
        'framework_id': {
            'value': ID
        },
        'request': {
            'requests': requests
        }
    })
开发者ID:douban,项目名称:pymesos,代码行数:26,代码来源:test_scheduler.py


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