本文整理汇总了Python中gen.apache.aurora.api.ttypes.Response.result方法的典型用法代码示例。如果您正苦于以下问题:Python Response.result方法的具体用法?Python Response.result怎么用?Python Response.result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gen.apache.aurora.api.ttypes.Response
的用法示例。
在下文中一共展示了Response.result方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_update_details_response
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def get_update_details_response(cls):
query_response = Response()
query_response.responseCode = ResponseCode.OK
query_response.result = Result()
details = JobUpdateDetails()
query_response.result.getJobUpdateDetailsResult = GetJobUpdateDetailsResult(details=details)
details.update = JobUpdate()
details.update.summary = JobUpdateSummary(
jobKey=AuroraJobKey("west", "mcc", "test", "hello"),
updateId="fake-update-identifier",
user="me",
state=JobUpdateState(
status=JobUpdateStatus.ROLLING_FORWARD,
createdTimestampMs=1411404927,
lastModifiedTimestampMs=14114056030,
),
)
details.updateEvents = [
JobUpdateEvent(status=JobUpdateStatus.ROLLING_FORWARD, timestampMs=1411404927),
JobUpdateEvent(status=JobUpdateStatus.ROLL_FORWARD_PAUSED, timestampMs=1411405000),
JobUpdateEvent(status=JobUpdateStatus.ROLLING_FORWARD, timestampMs=1411405100),
]
details.instanceEvents = [
JobInstanceUpdateEvent(instanceId=1, timestampMs=1411404930, action=JobUpdateAction.INSTANCE_UPDATING),
JobInstanceUpdateEvent(instanceId=2, timestampMs=1411404940, action=JobUpdateAction.INSTANCE_UPDATING),
JobInstanceUpdateEvent(instanceId=1, timestampMs=1411404950, action=JobUpdateAction.INSTANCE_UPDATED),
JobInstanceUpdateEvent(instanceId=2, timestampMs=1411404960, action=JobUpdateAction.INSTANCE_UPDATED),
]
return query_response
示例2: mock_scheduler
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def mock_scheduler(cls, response_code=None):
scheduler = create_autospec(spec=SchedulerThriftApiSpec, instance=True)
response_code = ResponseCode.OK if response_code is None else response_code
resp = Response(responseCode=response_code, details=[ResponseDetail(message='test')])
resp.result = Result(scheduleStatusResult=ScheduleStatusResult(tasks=cls.create_tasks()))
scheduler.getTasksWithoutConfigs.return_value = resp
return scheduler
示例3: get_update_details_response
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def get_update_details_response(cls):
query_response = Response()
query_response.responseCode = ResponseCode.OK
query_response.result = Result()
details = JobUpdateDetails(
update=JobUpdate(
summary=JobUpdateSummary(
key=UPDATE_KEY,
user="me",
state=JobUpdateState(
status=JobUpdateStatus.ROLLING_FORWARD, createdTimestampMs=1000, lastModifiedTimestampMs=2000
),
)
),
updateEvents=[
JobUpdateEvent(status=JobUpdateStatus.ROLLING_FORWARD, timestampMs=3000),
JobUpdateEvent(
status=JobUpdateStatus.ROLL_FORWARD_PAUSED, message="Investigating issues", timestampMs=4000
),
JobUpdateEvent(status=JobUpdateStatus.ROLLING_FORWARD, timestampMs=5000),
],
instanceEvents=[
JobInstanceUpdateEvent(instanceId=1, timestampMs=6000, action=JobUpdateAction.INSTANCE_UPDATING),
JobInstanceUpdateEvent(instanceId=2, timestampMs=7000, action=JobUpdateAction.INSTANCE_UPDATING),
JobInstanceUpdateEvent(instanceId=1, timestampMs=8000, action=JobUpdateAction.INSTANCE_UPDATED),
JobInstanceUpdateEvent(instanceId=2, timestampMs=9000, action=JobUpdateAction.INSTANCE_UPDATED),
],
)
query_response.result.getJobUpdateDetailsResult = GetJobUpdateDetailsResult(details=details)
return query_response
示例4: mock_scheduler
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def mock_scheduler(cls, response_code=None):
scheduler = Mock()
response_code = ResponseCode.OK if response_code is None else response_code
resp = Response(responseCode=response_code, messageDEPRECATED='test')
resp.result = Result(scheduleStatusResult=ScheduleStatusResult(tasks=cls.create_tasks()))
scheduler.getTasksWithoutConfigs.return_value = resp
return scheduler
示例5: expect_start
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def expect_start(self, response_code=None):
response_code = ResponseCode.OK if response_code is None else response_code
response = Response(responseCode=response_code,
messageDEPRECATED='test',
serverInfo=SERVER_INFO)
response.result = Result(acquireLockResult=AcquireLockResult(lock=self._lock))
self._scheduler.acquireLock(LockKey(job=self._job_key), self._session_key).AndReturn(response)
示例6: mock_get_quota
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def mock_get_quota(self, allocated, consumed, response_code=None):
response_code = ResponseCode.OK if response_code is None else response_code
resp = Response(responseCode=response_code, messageDEPRECATED="test")
resp.result = Result(
getQuotaResult=GetQuotaResult(quota=deepcopy(allocated), prodConsumption=deepcopy(consumed))
)
self._scheduler.getQuota.return_value = resp
示例7: mock_get_quota
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def mock_get_quota(self, allocated, consumed, response_code=None):
response_code = ResponseCode.OK if response_code is None else response_code
resp = Response(responseCode=response_code, details=[ResponseDetail(message='test')])
resp.result = Result(
getQuotaResult=GetQuotaResult(
quota=deepcopy(allocated), prodSharedConsumption=deepcopy(consumed)))
self._scheduler.getQuota.return_value = resp
示例8: expect_get_statuses
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def expect_get_statuses(self, instance_ids=WATCH_INSTANCES, num_calls=EXPECTED_CYCLES):
tasks = [self.create_task(instance_id) for instance_id in instance_ids]
response = Response(responseCode=ResponseCode.OK, messageDEPRECATED="test")
response.result = Result()
response.result.scheduleStatusResult = ScheduleStatusResult(tasks=tasks)
query = self.get_tasks_status_query(instance_ids)
for _ in range(int(num_calls)):
self._scheduler.getTasksWithoutConfigs(query).AndReturn(response)
示例9: expect_get_tasks
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def expect_get_tasks(self, tasks, ignore_ids=None, response_code=None):
response_code = ResponseCode.OK if response_code is None else response_code
response = Response(responseCode=response_code,
messageDEPRECATED='test',
serverInfo=SERVER_INFO)
scheduled = []
for index, task in enumerate(tasks):
if not ignore_ids or index not in ignore_ids:
scheduled.append(ScheduledTask(assignedTask=AssignedTask(task=task, instanceId=index)))
response.result = Result(scheduleStatusResult=ScheduleStatusResult(tasks=scheduled))
query = TaskQuery(jobKeys=[self._job_key], statuses=ACTIVE_STATES)
self._scheduler.getTasksStatus(query).AndReturn(response)
示例10: mock_status_active_tasks
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def mock_status_active_tasks(self, instance_ids):
tasks = []
for i in instance_ids:
tasks.append(ScheduledTask(
status=ScheduleStatus.RUNNING,
assignedTask=AssignedTask(task=TaskConfig(), instanceId=i)
))
response = Response(responseCode=ResponseCode.OK, messageDEPRECATED='test')
response.result = Result()
response.result.scheduleStatusResult = ScheduleStatusResult(tasks=tasks)
self.mock_scheduler.getTasksWithoutConfigs(IgnoreArg()).AndReturn(response)
示例11: expect_get_tasks
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def expect_get_tasks(self, tasks, ignore_ids=None, response_code=None):
response_code = ResponseCode.OK if response_code is None else response_code
response = Response(responseCode=response_code, messageDEPRECATED='test')
scheduled = []
for index, task in enumerate(tasks):
if not ignore_ids or index not in ignore_ids:
scheduled.append(ScheduledTask(assignedTask=AssignedTask(task=task, instanceId=index)))
response.result = Result(scheduleStatusResult=ScheduleStatusResult(tasks=scheduled))
query = TaskQuery(
owner=Identity(role=self._job_key.role),
environment=self._job_key.environment,
jobName=self._job_key.name,
statuses=ACTIVE_STATES)
self._scheduler.getTasksStatus(query).AndReturn(response)
示例12: get_status_query_response
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def get_status_query_response(self, count=3):
query_response = Response()
query_response.responseCode = ResponseCode.OK
query_response.result = Result()
summaries = GetJobUpdateSummariesResult()
query_response.result.getJobUpdateSummariesResult = summaries
summaries.updateSummaries = [JobUpdateSummary(
updateId="%s" % i,
jobKey=self.TEST_JOBKEY.to_thrift(),
user="me",
state=JobUpdateState(
status=JobUpdateStatus.ROLLED_FORWARD,
createdTimestampMs=1411404927,
lastModifiedTimestampMs=14114056030)) for i in range(count)]
return query_response
示例13: setUp
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def setUp(self):
self.mox = Mox()
self.mox.StubOutClassWithMocks(AuroraAdmin, 'Client')
self.mox.StubOutClassWithMocks(scheduler_client, 'SchedulerClient')
self.mock_scheduler_client = self.mox.CreateMock(scheduler_client.SchedulerClient)
self.mock_thrift_client = self.mox.CreateMock(AuroraAdmin.Client)
scheduler_client.SchedulerClient.get(IgnoreArg(), verbose=IgnoreArg()).AndReturn(
self.mock_scheduler_client)
self.mock_scheduler_client.get_thrift_client().AndReturn(self.mock_thrift_client)
version_resp = Response(responseCode=ResponseCode.OK)
version_resp.result = Result(getVersionResult=CURRENT_API_VERSION)
self.mock_thrift_client.getVersion().AndReturn(version_resp)
示例14: get_update_details_response
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def get_update_details_response(self):
query_response = Response()
query_response.responseCode = ResponseCode.OK
query_response.result = Result()
details = JobUpdateDetails(
update=JobUpdate(
summary=JobUpdateSummary(
jobKey=self.TEST_JOBKEY.to_thrift(),
updateId="0",
user="me",
state=JobUpdateState(
status=JobUpdateStatus.ROLLING_FORWARD,
createdTimestampMs=1411404927,
lastModifiedTimestampMs=14114056030))),
updateEvents=[
JobUpdateEvent(
status=JobUpdateStatus.ROLLING_FORWARD,
timestampMs=1411404927),
JobUpdateEvent(
status=JobUpdateStatus.ROLL_FORWARD_PAUSED,
timestampMs=1411405000),
JobUpdateEvent(
status=JobUpdateStatus.ROLLING_FORWARD,
timestampMs=1411405100)],
instanceEvents=[
JobInstanceUpdateEvent(
instanceId=1,
timestampMs=1411404930,
action=JobUpdateAction.INSTANCE_UPDATING),
JobInstanceUpdateEvent(
instanceId=2,
timestampMs=1411404940,
action=JobUpdateAction.INSTANCE_UPDATING),
JobInstanceUpdateEvent(
instanceId=1,
timestampMs=1411404950,
action=JobUpdateAction.INSTANCE_UPDATED),
JobInstanceUpdateEvent(
instanceId=2,
timestampMs=1411404960,
action=JobUpdateAction.INSTANCE_UPDATED)])
query_response.result.getJobUpdateDetailsResult = GetJobUpdateDetailsResult(details=details)
return query_response
示例15: get_status_query_response
# 需要导入模块: from gen.apache.aurora.api.ttypes import Response [as 别名]
# 或者: from gen.apache.aurora.api.ttypes.Response import result [as 别名]
def get_status_query_response(cls):
query_response = Response()
query_response.responseCode = ResponseCode.OK
query_response.result = Result()
summaries = GetJobUpdateSummariesResult()
query_response.result.getJobUpdateSummariesResult = summaries
summaries.updateSummaries = [
JobUpdateSummary(
updateId="hello",
jobKey=AuroraJobKey("west", "mcc", "test", "hello"),
user="me",
state=JobUpdateState(
status=JobUpdateStatus.ROLLING_FORWARD,
createdTimestampMs=1411404927,
lastModifiedTimestampMs=14114056030,
),
),
JobUpdateSummary(
updateId="goodbye",
jobKey=AuroraJobKey("west", "mch", "prod", "goodbye"),
user="me",
state=JobUpdateState(
status=JobUpdateStatus.ROLLING_BACK,
createdTimestampMs=1411300632,
lastModifiedTimestampMs=14114092632,
),
),
JobUpdateSummary(
updateId="gasp",
jobKey=AuroraJobKey("west", "mcq", "devel", "gasp"),
user="me",
state=JobUpdateState(
status=JobUpdateStatus.ROLL_FORWARD_PAUSED,
createdTimestampMs=1411600891,
lastModifiedTimestampMs=1411800891,
),
),
]
return query_response