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


Python ttypes.Response类代码示例

本文整理汇总了Python中gen.apache.aurora.api.ttypes.Response的典型用法代码示例。如果您正苦于以下问题:Python Response类的具体用法?Python Response怎么用?Python Response使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: get_update_details_response

 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
开发者ID:kidaa,项目名称:aurora,代码行数:30,代码来源:test_supdate.py

示例2: mock_scheduler

 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
开发者ID:bhuvan,项目名称:incubator-aurora,代码行数:7,代码来源:test_task_util.py

示例3: mock_scheduler

 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
开发者ID:AltanAlpay,项目名称:aurora,代码行数:7,代码来源:test_task_util.py

示例4: expect_start

 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)
开发者ID:kevints,项目名称:aurora,代码行数:7,代码来源:test_updater.py

示例5: get_update_details_response

 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
开发者ID:vrosnet,项目名称:incubator-aurora,代码行数:29,代码来源:test_supdate.py

示例6: mock_get_quota

  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
开发者ID:abdasgupta,项目名称:aurora,代码行数:8,代码来源:test_quota_check.py

示例7: mock_get_quota

    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
开发者ID:kevinburg,项目名称:incubator-aurora,代码行数:8,代码来源:test_quota_check.py

示例8: mock_restart_fails

 def mock_restart_fails(self):
   response = Response(responseCode=ResponseCode.ERROR, messageDEPRECATED='test error')
   response.serverInfo = ServerInfo(thriftAPIVersion=THRIFT_API_VERSION)
   self.mock_scheduler.restartShards(
       JOB.to_thrift(),
       IgnoreArg(),
       self.lock,
       SESSION_KEY).AndReturn(response)
开发者ID:kevints,项目名称:aurora,代码行数:8,代码来源:test_restarter.py

示例9: expect_get_statuses

    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)
开发者ID:kevints,项目名称:aurora,代码行数:9,代码来源:test_instance_watcher.py

示例10: mock_restart_instances

  def mock_restart_instances(self, instances, lock=None):
    response = Response(responseCode=ResponseCode.OK, messageDEPRECATED='test')
    response.serverInfo = ServerInfo(thriftAPIVersion=THRIFT_API_VERSION)

    self.mock_scheduler.restartShards(
        JOB.to_thrift(),
        instances,
        lock,
        SESSION_KEY).AndReturn(response)
    self.mock_instance_watcher.watch(instances).AndReturn([])
开发者ID:kevints,项目名称:aurora,代码行数:10,代码来源:test_restarter.py

示例11: expect_get_tasks

 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)
开发者ID:kevints,项目名称:aurora,代码行数:12,代码来源:test_updater.py

示例12: mock_status_active_tasks

  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)
开发者ID:bhuvan,项目名称:incubator-aurora,代码行数:12,代码来源:test_restarter.py

示例13: expect_get_tasks

 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)
开发者ID:kpfell,项目名称:incubator-aurora,代码行数:14,代码来源:test_updater.py

示例14: get_status_query_response

 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
开发者ID:dominichamon,项目名称:incubator-aurora,代码行数:15,代码来源:test_supdate.py

示例15: setUp

  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)
开发者ID:kevinburg,项目名称:incubator-aurora,代码行数:17,代码来源:test_scheduler_client.py


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