Ejemplo n.º 1
0
 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="******",
             state=JobUpdateState(status=JobUpdateStatus.ROLLING_FORWARD,
                                  createdTimestampMs=1411404927,
                                  lastModifiedTimestampMs=14114056030)),
         JobUpdateSummary(
             updateId="goodbye",
             jobKey=AuroraJobKey('west', 'mch', 'prod', 'goodbye'),
             user="******",
             state=JobUpdateState(status=JobUpdateStatus.ROLLING_BACK,
                                  createdTimestampMs=1411300632,
                                  lastModifiedTimestampMs=14114092632)),
         JobUpdateSummary(updateId="gasp",
                          jobKey=AuroraJobKey('west', 'mcq', 'devel',
                                              'gasp'),
                          user="******",
                          state=JobUpdateState(
                              status=JobUpdateStatus.ROLL_FORWARD_PAUSED,
                              createdTimestampMs=1411600891,
                              lastModifiedTimestampMs=1411800891))
     ]
     return query_response
Ejemplo n.º 2
0
def get_status_query_response(count=1, status=JobUpdateStatus.ROLLED_FORWARD):
    return Response(
        responseCode=ResponseCode.OK,
        result=Result(getJobUpdateSummariesResult=GetJobUpdateSummariesResult(
            updateSummaries=[
                JobUpdateSummary(key=UPDATE_KEY,
                                 user="******",
                                 state=JobUpdateState(
                                     status=status,
                                     createdTimestampMs=1411404927,
                                     lastModifiedTimestampMs=14114056030))
                for i in range(count)
            ])))
Ejemplo n.º 3
0
 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="******",
       state=JobUpdateState(
           status=JobUpdateStatus.ROLLED_FORWARD,
           createdTimestampMs=1411404927,
           lastModifiedTimestampMs=14114056030)) for i in range(count)]
   return query_response
Ejemplo n.º 4
0
 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="******",
             state=JobUpdateState(status=JobUpdateStatus.ROLLING_FORWARD,
                                  createdTimestampMs=1000,
                                  lastModifiedTimestampMs=2000),
             metadata={
                 Metadata("issue", "test"),
                 Metadata("country", "America"),
                 Metadata("country", "Canada")
             })),
         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(
         detailsList=[details])
     return query_response
Ejemplo n.º 5
0
 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="******",
               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
Ejemplo n.º 6
0
 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="******",
         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
Ejemplo n.º 7
0
 def create_start_job_update_result(cls, code, msg, key, metadata):
     resp = cls.create_blank_response(code, msg)
     resp.result = Result(startJobUpdateResult=StartJobUpdateResult(
         key=key, updateSummary=JobUpdateSummary(metadata=metadata)))
     return resp