本文整理匯總了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
}
})
示例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,
}
})
示例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,
}
})
示例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
}
})
示例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,
}
})
示例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
},
})
示例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'},
}
})
示例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']
}
})
示例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
}
})
示例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
}
})