Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
skip get task api test; sync swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
suiguoxin committed Oct 20, 2020
1 parent 79cd093 commit ef1191e
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 91 deletions.
11 changes: 11 additions & 0 deletions src/api/v2/models/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ export interface IJobStatusDetails {
retryDelayTime?: any;
createdTime: number;
completedTime: number | null;
attemptId: number | null;
attemptState: string | null;
appId: string;
appProgress: number;
appTrackingUrl: string;
appCreatedTime: number | null;
appLaunchedTime: number | null;
appCompletedTime: number | null;
appExitCode: number | null;
Expand All @@ -105,7 +108,14 @@ export interface IJobStatusDetails {

export interface ITaskStatus {
taskIndex: number;
taskUid: string;
taskState: string;
retries: number;
accountableRetries: number;
createdTime: number | null;
completedTime: number | null;
attemptId: number | null;
attemptState: string | null;
containerId: string;
containerIp: string;
containerPorts: { [index: string]: number | number[] | string; };
Expand Down Expand Up @@ -138,6 +148,7 @@ export interface IJobStatus {
interface ITaskAttempt {
attemptId: number;
attemptState: string;
currentAttemptCreatedTime: number | null;
currentAttemptLaunchedTime: number | null;
currentAttemptCompletedTime: number | null;
containerId: string | null;
Expand Down
30 changes: 27 additions & 3 deletions src/api/v2/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,7 @@ paths:
attemptId: 0
attemptState: SUCCEEDED,
appId: id
appCreatedTime: 0
appLaunchedTime: 0
appCompletedTime: 0
appExitCode: 0
Expand Down Expand Up @@ -1265,6 +1266,7 @@ paths:
attemptId: 0
attemptState: SUCCEEDED,
appId: id
appCreatedTime: 0
appLaunchedTime: 0
appCompletedTime: 0
appExitCode: 0
Expand Down Expand Up @@ -1711,6 +1713,7 @@ paths:
attempts:
- attemptId: 0
attemptState: FAILED
currentAttemptCreatedTime: 1602480558000
currentAttemptLaunchedTime: 1602480558000
currentAttemptCompletedTime: 1602480570000
containerId: a9f9f1f2-5e43-4423-88c3-022433b8cd7c
Expand All @@ -1737,6 +1740,7 @@ paths:
containerExitDiagnostics: Stop to complete current FrameworkAttempt
- attemptId: 1
attemptState: FAILED
currentAttemptCreatedTime: 1602480591000
currentAttemptLaunchedTime: 1602480591000
currentAttemptCompletedTime: 1602480603000
containerId: a9f9f1f2-5e43-4423-88c3-022433b8cd7c
Expand Down Expand Up @@ -2216,6 +2220,12 @@ components:
appId:
type: string
description: unique id for the job
appCreatedTime:
type: integer
nullable: true
description: >-
job created time for last attempt, in number of milliseconds
since the Unix Epoch.
appLaunchedTime:
type: integer
nullable: true
Expand All @@ -2227,11 +2237,12 @@ components:
nullable: true
description: >
job completed time for last attempt, in number of milliseconds
since the Unix Epoch. to get durations for last attempt:
since the Unix Epoch.
To get durations for last attempt:
wholeDuration = completedTime - createdTime;
runningDuration = appCompletedTime - appLaunchedTime;
waitingDuration = wholeDuration - runningDuration.
to get durations for all attempts:
To get durations for all attempts:
runningDuration = sum(appCompletedTime - appLaunchedTime) for all attempts.
appExitCode:
type: integer
Expand Down Expand Up @@ -2313,6 +2324,7 @@ components:
- retries
- createdTime
- completedTime
- appCreatedTime
- appLaunchedTime
- appCompletedTime
- appExitCode
Expand Down Expand Up @@ -2433,6 +2445,12 @@ components:
type: integer
attemptState:
type: string
currentAttemptCreatedTime:
type: integer
nullable: true
description: >-
the current attempt created time, in number of milliseconds since the Unix
Epoch.
currentAttemptLaunchedTime:
type: integer
nullable: true
Expand Down Expand Up @@ -2891,6 +2909,12 @@ components:
type: integer
attemptState:
type: string
currentAttemptCreatedTime:
type: integer
nullable: true
description: >-
the current attempt created time, in number of milliseconds since the Unix
Epoch.
currentAttemptLaunchedTime:
type: integer
nullable: true
Expand Down Expand Up @@ -2969,7 +2993,7 @@ components:
nullable: true
properties:
affinityGroupName:
type: object
type: string
nullable: true
lazyPreempted:
type: object
Expand Down
92 changes: 4 additions & 88 deletions tests/common/apiTestCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -946,97 +946,13 @@ export const ApiDefaultTestCases: {[key: string]: IApiTestCase} = {
after: [ updateTestJobExecutionType('STOP') ]
},
'get /api/v2/jobs/{user}~{job}/attempts/{jobAttemptId}/taskRoles/{taskRoleName}/taskIndex/{taskIndex}/attempts': {
before: [ createTestRunningJob() ],
tests: [
{
description: 'Get task status',
operation: {
parameters: [
{
type: 'raw',
value: clustersJson[0].username
},
{
type: 'raw',
value: 'sdk_test_job' + randomString.get()
},
{
type: 'raw',
value: 0
},
{
type: 'raw',
value: 'worker'
},
{
type: 'raw',
value: 0
}
]
}
},
{
description: 'Get task of a nonexist job',
operation: {
parameters: [
{
type: 'raw',
value: clustersJson[0].username
},
{
type: 'raw',
value: 'sdk_test_nonexist_job'
},
{
type: 'raw',
value: 0
},
{
type: 'raw',
value: 'worker'
},
{
type: 'raw',
value: 0
}
],
response: {
statusCode: 404
}
}
},
{
description: 'Get nonexist task attempt',
operation: {
parameters: [
{
type: 'raw',
value: clustersJson[0].username
},
{
type: 'raw',
value: 'sdk_test_job'
},
{
type: 'raw',
value: 0
},
{
type: 'raw',
value: 'worker'
},
{
type: 'raw',
value: 5
}
],
response: {
statusCode: 404
}
}
// Skip the test temporarily to avoid highly increasing CI cost.
description: 'Skip',
customizedTest: 'skipTest'
}
],
after: [ updateTestJobExecutionType('STOP') ]
]
},
'get /api/v2/jobs/{user}~{job}/config': {
before: [ createTestJob() ],
Expand Down
10 changes: 10 additions & 0 deletions tests/common/test_data/testJobStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ export const testJobStatus: IJobStatus = {
},
createdTime: 1565329763372,
completedTime: null,
attemptId: 0,
attemptState: 'RUNNING',
appId: 'application_1565337391589_0002',
appProgress: 0,
appTrackingUrl: 'http://0.0.0.34/yarn/0.0.0.34:8088/proxy/application_1565337391589_0002/',
appCreatedTime: 1565337476313,
appLaunchedTime: 1565337476313,
appCompletedTime: null,
appExitCode: null,
Expand All @@ -48,7 +51,14 @@ export const testJobStatus: IJobStatus = {
taskStatuses: [
{
taskIndex: 0,
taskUid: '65b2e476-1101-11eb-b396-96ba8c8049b4',
taskState: 'RUNNING',
retries: 0,
accountableRetries: 0,
createdTime: 1602998326000,
completedTime: null,
attemptId: 0,
attemptState: 'RUNNING',
containerId: 'container_e34_1565337391589_0002_01_000002',
containerIp: '0.0.0.38',
containerPorts: {
Expand Down
2 changes: 2 additions & 0 deletions tests/common/test_data/testTaskDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const testTaskDetail: ITaskDetail = {
{
attemptId: 1,
attemptState: 'STOPPED',
currentAttemptCreatedTime: 1602665952000,
currentAttemptLaunchedTime: 1602665952000,
currentAttemptCompletedTime: 1602665969000,
containerId: 'b62b9972-ee99-405d-a1bc-9f4467b7289a',
Expand Down Expand Up @@ -58,6 +59,7 @@ export const testTaskDetail: ITaskDetail = {
{
attemptId: 0,
attemptState: 'STOPPED',
currentAttemptCreatedTime: 1602665934000,
currentAttemptLaunchedTime: 1602665934000,
currentAttemptCompletedTime: 1602665952000,
containerId: '142b5212-1f2b-4ad6-83da-17d7d1e99e4f',
Expand Down

0 comments on commit ef1191e

Please sign in to comment.