From cf29f25bb4d3402196192241005669133c2af3d3 Mon Sep 17 00:00:00 2001 From: Mingliang Tao Date: Tue, 7 Jul 2020 20:32:06 +0800 Subject: [PATCH] Add more task debug info in jobInfo api response [rest-server] (#4667) --- src/rest-server/docs/swagger.yaml | 706 ++++++++++-------- src/rest-server/src/models/v2/job/k8s.js | 11 + .../job/job-submit-v1/job-submit.component.js | 4 +- 3 files changed, 402 insertions(+), 319 deletions(-) diff --git a/src/rest-server/docs/swagger.yaml b/src/rest-server/docs/swagger.yaml index c34ebe7663..5ffda0e0bc 100644 --- a/src/rest-server/docs/swagger.yaml +++ b/src/rest-server/docs/swagger.yaml @@ -9,11 +9,11 @@ info: Version 2.0.4: add default field in get storage list license: name: MIT License - url: 'https://github.com/microsoft/pai/blob/master/LICENSE' - version: 2.0.3 + url: "https://github.com/microsoft/pai/blob/master/LICENSE" + version: 2.0.4 externalDocs: description: Find out more about OpenPAI - url: 'https://github.com/microsoft/pai' + url: "https://github.com/microsoft/pai" tags: - name: api description: API information @@ -44,7 +44,7 @@ paths: description: Get OpenPAI cluster info. operationId: getClusterInfo responses: - '200': + "200": description: Succeeded content: application/json: @@ -73,10 +73,10 @@ paths: - launcherType - authnMethod example: - name: 'PAI RESTful API' - version: 'v1.0.1' - launcherType: 'k8s' - authnMethod: 'basic' + name: "PAI RESTful API" + version: "v1.0.1" + launcherType: "k8s" + authnMethod: "basic" /api/v2/tokens: get: tags: @@ -87,7 +87,7 @@ paths: security: - bearerAuth: [] responses: - '200': + "200": description: Succeeded content: application/json: @@ -103,10 +103,10 @@ paths: - tokens example: tokens: - - 'JWT Token Example' - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '/api/v2/tokens/{token}': + - "JWT Token Example" + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "/api/v2/tokens/{token}": delete: tags: - token @@ -116,20 +116,20 @@ paths: security: - bearerAuth: [] parameters: - - $ref: '#/components/parameters/token' + - $ref: "#/components/parameters/token" responses: - '200': + "200": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" example: message: revoke successfully - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '403': - $ref: '#/components/responses/ForbiddenUserError' + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "403": + $ref: "#/components/responses/ForbiddenUserError" /api/v2/tokens/application: post: tags: @@ -143,7 +143,7 @@ paths: security: - bearerAuth: [] responses: - '200': + "200": description: Succeeded content: application/json: @@ -155,12 +155,12 @@ paths: description: your access token application: type: boolean - description: 'true' + description: "true" example: - token: 'JWT Token Example' + token: "JWT Token Example" application: true - '401': - $ref: '#/components/responses/UnauthorizedUserError' + "401": + $ref: "#/components/responses/UnauthorizedUserError" /api/v2/authn/oidc/login: get: tags: @@ -169,7 +169,7 @@ paths: description: After call this API in web browser, restserver will redirect your page to Azure AD for authentication. Only be used in webportal. operationId: oidcLogin responses: - '302': + "302": description: Redirect /api/v2/authn/oidc/logout: get: @@ -179,7 +179,7 @@ paths: description: After call this API in web browser, restserver will redirect your page to Azure AD for logout. operationId: oidcLogout responses: - '302': + "302": description: Redirect /api/v2/authn/basic/login: post: @@ -211,7 +211,7 @@ paths: - password required: true responses: - '200': + "200": description: Succeeded content: application/json: @@ -232,17 +232,17 @@ paths: - user - admin example: - token: 'JWT Token Example' - user: 'user' + token: "JWT Token Example" + user: "user" admin: true - '400': + "400": description: NoUserError or IncorrectPasswordError content: application/json: schema: - $ref: '#/components/schemas/Response' - '404': - $ref: '#/components/responses/NoUserError' + $ref: "#/components/schemas/Response" + "404": + $ref: "#/components/responses/NoUserError" /api/v2/authn/basic/logout: delete: tags: @@ -253,24 +253,24 @@ paths: security: - bearerAuth: [] responses: - '200': + "200": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" example: message: Logout successfully - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '403': - $ref: '#/components/responses/ForbiddenUserError' + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "403": + $ref: "#/components/responses/ForbiddenUserError" /api/v2/users: post: tags: - user summary: Create a user in the system. - description: 'Create a user in the system by admin, basic authentication mode only.' + description: "Create a user in the system by admin, basic authentication mode only." operationId: createUser security: - bearerAuth: [] @@ -304,32 +304,32 @@ paths: - password required: true responses: - '201': + "201": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" example: message: User is created successfully - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '403': - $ref: '#/components/responses/ForbiddenUserError' - '409': - $ref: '#/components/responses/ConflictUserError' - '500': - $ref: '#/components/responses/UnknownError' + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "403": + $ref: "#/components/responses/ForbiddenUserError" + "409": + $ref: "#/components/responses/ConflictUserError" + "500": + $ref: "#/components/responses/UnknownError" get: tags: - user summary: Get all users in the system. - description: 'Get all users in the system by admin.' + description: "Get all users in the system by admin." operationId: getAllUser security: - bearerAuth: [] responses: - '200': + "200": description: Succeeded content: application/json: @@ -337,16 +337,16 @@ paths: description: Array with all users in the system. type: array items: - $ref: '#/components/schemas/UserInfo' + $ref: "#/components/schemas/UserInfo" example: - username: username admin: true virtualCluster: [] storageConfig: [] - email: 'email@test.com' + email: "email@test.com" extension: {} - '500': - $ref: '#/components/responses/UnknownError' + "500": + $ref: "#/components/responses/UnknownError" put: tags: - user @@ -414,22 +414,22 @@ paths: type: boolean default: false responses: - '201': + "201": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" example: - message: 'update group {username} successfully.' - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '403': - $ref: '#/components/responses/ForbiddenUserError' - '404': - $ref: '#/components/responses/NoUserError' - '500': - $ref: '#/components/responses/UnknownError' + message: "update group {username} successfully." + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "403": + $ref: "#/components/responses/ForbiddenUserError" + "404": + $ref: "#/components/responses/NoUserError" + "500": + $ref: "#/components/responses/UnknownError" /api/v2/users/me: put: tags: @@ -478,25 +478,25 @@ paths: type: boolean default: false responses: - '201': + "201": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" example: - message: 'update group {username} successfully.' - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '403': - $ref: '#/components/responses/ForbiddenUserError' - '404': - $ref: '#/components/responses/NoUserError' - '500': - $ref: '#/components/responses/UnknownError' - '/api/v2/users/{user}': + message: "update group {username} successfully." + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "403": + $ref: "#/components/responses/ForbiddenUserError" + "404": + $ref: "#/components/responses/NoUserError" + "500": + $ref: "#/components/responses/UnknownError" + "/api/v2/users/{user}": parameters: - - $ref: '#/components/parameters/user' + - $ref: "#/components/parameters/user" get: tags: - user @@ -508,25 +508,25 @@ paths: security: - bearerAuth: [] responses: - '200': + "200": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/UserInfo' + $ref: "#/components/schemas/UserInfo" example: username: username admin: true virtualCluster: [] storageConfig: [] - email: 'email@test.com' + email: "email@test.com" extension: {} - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '404': - $ref: '#/components/responses/NoUserError' - '500': - $ref: '#/components/responses/UnknownError' + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "404": + $ref: "#/components/responses/NoUserError" + "500": + $ref: "#/components/responses/UnknownError" delete: tags: - user @@ -539,25 +539,25 @@ paths: security: - bearerAuth: [] responses: - '200': + "200": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" example: message: user is removed successfully - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '403': - $ref: '#/components/responses/ForbiddenUserError' - '404': - $ref: '#/components/responses/NoUserError' - '500': - $ref: '#/components/responses/UnknownError' - '/api/v2/users/{user}/group/': + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "403": + $ref: "#/components/responses/ForbiddenUserError" + "404": + $ref: "#/components/responses/NoUserError" + "500": + $ref: "#/components/responses/UnknownError" + "/api/v2/users/{user}/group/": parameters: - - $ref: '#/components/parameters/user' + - $ref: "#/components/parameters/user" put: tags: - user @@ -580,22 +580,22 @@ paths: type: string default: the group will be added into the user's grouplist. responses: - '201': + "201": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" example: - message: 'User {username} is added into group {groupname}' - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '403': - $ref: '#/components/responses/ForbiddenUserError' - '404': - $ref: '#/components/responses/NoUserError' - '500': - $ref: '#/components/responses/UnknownError' + message: "User {username} is added into group {groupname}" + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "403": + $ref: "#/components/responses/ForbiddenUserError" + "404": + $ref: "#/components/responses/NoUserError" + "500": + $ref: "#/components/responses/UnknownError" delete: tags: - user @@ -618,25 +618,25 @@ paths: type: string description: the group will be removed from the user's grouplist. responses: - '201': + "201": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" example: - message: 'User {username} is removed from group {groupname}' - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '403': - $ref: '#/components/responses/ForbiddenUserError' - '404': - $ref: '#/components/responses/NoUserError' - '500': - $ref: '#/components/responses/UnknownError' - '/api/v2/users/{user}/grouplist/': + message: "User {username} is removed from group {groupname}" + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "403": + $ref: "#/components/responses/ForbiddenUserError" + "404": + $ref: "#/components/responses/NoUserError" + "500": + $ref: "#/components/responses/UnknownError" + "/api/v2/users/{user}/grouplist/": parameters: - - $ref: '#/components/parameters/user' + - $ref: "#/components/parameters/user" put: tags: - user @@ -661,22 +661,22 @@ paths: items: type: string responses: - '201': + "201": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" example: - message: 'update user grouplist successfully.' - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '403': - $ref: '#/components/responses/ForbiddenUserError' - '404': - $ref: '#/components/responses/NoUserError' - '500': - $ref: '#/components/responses/UnknownError' + message: "update user grouplist successfully." + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "403": + $ref: "#/components/responses/ForbiddenUserError" + "404": + $ref: "#/components/responses/NoUserError" + "500": + $ref: "#/components/responses/UnknownError" /api/v2/groups: get: tags: @@ -687,7 +687,7 @@ paths: security: - bearerAuth: [] responses: - '200': + "200": description: Succeeded content: application/json: @@ -713,8 +713,8 @@ paths: description: description externalName: externalName extension: {} - '500': - $ref: '#/components/responses/UnknownError' + "500": + $ref: "#/components/responses/UnknownError" post: tags: - group @@ -747,20 +747,20 @@ paths: - groupname required: true responses: - '201': + "201": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" example: message: group is created successfully - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '403': - $ref: '#/components/responses/ForbiddenUserError' - '500': - $ref: '#/components/responses/UnknownError' + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "403": + $ref: "#/components/responses/ForbiddenUserError" + "500": + $ref: "#/components/responses/UnknownError" put: tags: - group @@ -799,25 +799,25 @@ paths: default: false required: true responses: - '201': + "201": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" example: - message: 'update group {groupname} successfully.' - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '403': - $ref: '#/components/responses/ForbiddenUserError' - '404': - $ref: '#/components/responses/NoGroupError' - '500': - $ref: '#/components/responses/UnknownError' - '/api/v2/groups/{group}': + message: "update group {groupname} successfully." + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "403": + $ref: "#/components/responses/ForbiddenUserError" + "404": + $ref: "#/components/responses/NoGroupError" + "500": + $ref: "#/components/responses/UnknownError" + "/api/v2/groups/{group}": parameters: - - $ref: '#/components/parameters/group' + - $ref: "#/components/parameters/group" get: tags: - group @@ -828,7 +828,7 @@ paths: security: - bearerAuth: [] responses: - '200': + "200": description: Succeeded content: application/json: @@ -856,12 +856,12 @@ paths: description: description externalName: externalName extension: {} - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '404': - $ref: '#/components/responses/NoGroupError' - '500': - $ref: '#/components/responses/UnknownError' + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "404": + $ref: "#/components/responses/NoGroupError" + "500": + $ref: "#/components/responses/UnknownError" delete: tags: - group @@ -873,23 +873,23 @@ paths: security: - bearerAuth: [] responses: - '201': + "201": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" example: message: group is removed successfully - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '403': - $ref: '#/components/responses/ForbiddenUserError' - '500': - $ref: '#/components/responses/UnknownError' - '/api/v2/groups/{group}/userlist': + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "403": + $ref: "#/components/responses/ForbiddenUserError" + "500": + $ref: "#/components/responses/UnknownError" + "/api/v2/groups/{group}/userlist": parameters: - - $ref: '#/components/parameters/group' + - $ref: "#/components/parameters/group" get: tags: - group @@ -897,7 +897,7 @@ paths: description: Get the user array of a group in the system. operationId: getGroupMembers responses: - '200': + "200": description: Succeeded content: application/json: @@ -916,10 +916,10 @@ paths: example: - username: username clusterAdmin: false - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '500': - $ref: '#/components/responses/UnknownError' + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "500": + $ref: "#/components/responses/UnknownError" /api/v2/virtual-clusters: get: tags: @@ -930,17 +930,17 @@ paths: security: - bearerAuth: [] responses: - '200': + "200": description: Succeeded content: application/json: schema: type: object additionalProperties: - $ref: '#/components/schemas/VirtualCluster' - '500': - $ref: '#/components/responses/UnknownError' - '/api/v2/virtual-clusters/{vc}': + $ref: "#/components/schemas/VirtualCluster" + "500": + $ref: "#/components/responses/UnknownError" + "/api/v2/virtual-clusters/{vc}": get: tags: - virtual cluster @@ -950,14 +950,14 @@ paths: security: - bearerAuth: [] parameters: - - $ref: '#/components/parameters/vc' + - $ref: "#/components/parameters/vc" responses: - '200': + "200": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/VirtualCluster' + $ref: "#/components/schemas/VirtualCluster" example: capacity: 70 usedCapacity: 30 @@ -981,10 +981,10 @@ paths: vCores: 2 GPUs: 2 maxCapacity: 70 - '404': - $ref: '#/components/responses/NoVirtualClusterError' - '500': - $ref: '#/components/responses/UnknownError' + "404": + $ref: "#/components/responses/NoVirtualClusterError" + "500": + $ref: "#/components/responses/UnknownError" /api/v2/storages: get: tags: @@ -1001,20 +1001,20 @@ paths: schema: type: boolean responses: - '200': + "200": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/StorageSummary' + $ref: "#/components/schemas/StorageSummary" example: storages: - name: name share: true volumeName: volumeName - '500': - $ref: '#/components/responses/UnknownError' - '/api/v2/storages/{storage}': + "500": + $ref: "#/components/responses/UnknownError" + "/api/v2/storages/{storage}": get: tags: - storage @@ -1024,14 +1024,14 @@ paths: security: - bearerAuth: [] parameters: - - $ref: '#/components/parameters/storage' + - $ref: "#/components/parameters/storage" responses: - '200': + "200": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/StorageDetail' + $ref: "#/components/schemas/StorageDetail" example: name: nfs-storage-name share: true @@ -1040,21 +1040,21 @@ paths: data: server: path: "/data" - '403': + "403": description: ForbiddenUserError content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: ForbiddenUserError: value: code: ForbiddenUserError - message: 'User {user} is not allowed to access {storage}.' - '404': - $ref: '#/components/responses/NoStorageError' - '500': - $ref: '#/components/responses/UnknownError' + message: "User {user} is not allowed to access {storage}." + "404": + $ref: "#/components/responses/NoStorageError" + "500": + $ref: "#/components/responses/UnknownError" /api/v2/jobs: post: tags: @@ -1069,25 +1069,25 @@ paths: content: text/yaml: schema: - $ref: '#/components/schemas/JobProtocol' + $ref: "#/components/schemas/JobProtocol" required: true responses: - '202': + "202": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" example: - message: 'update job {job} successfully' - '400': - $ref: '#/components/responses/NoVirtualClusterError' - '403': - $ref: '#/components/responses/ForbiddenUserError' - '409': - $ref: '#/components/responses/ConflictJobError' - '500': - $ref: '#/components/responses/UnknownError' + message: "update job {job} successfully" + "400": + $ref: "#/components/responses/NoVirtualClusterError" + "403": + $ref: "#/components/responses/ForbiddenUserError" + "409": + $ref: "#/components/responses/ConflictJobError" + "500": + $ref: "#/components/responses/UnknownError" get: tags: - job @@ -1103,14 +1103,14 @@ paths: schema: type: string responses: - '200': + "200": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/JobSummary' + $ref: "#/components/schemas/JobSummary" example: - - protocolVersion: '2' + - protocolVersion: "2" name: job name username: user name state: SUCCEEDED @@ -1121,9 +1121,9 @@ paths: completedTime: 0 appExitCode: 0 virtualCluster: unknown - '500': - $ref: '#/components/responses/UnknownError' - '/api/v2/jobs/{user}~{job}': + "500": + $ref: "#/components/responses/UnknownError" + "/api/v2/jobs/{user}~{job}": get: tags: - job @@ -1133,15 +1133,15 @@ paths: security: - bearerAuth: [] parameters: - - $ref: '#/components/parameters/user' - - $ref: '#/components/parameters/job' + - $ref: "#/components/parameters/user" + - $ref: "#/components/parameters/job" responses: - '200': + "200": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/JobDetail' + $ref: "#/components/schemas/JobDetail" example: name: job name jobStatus: @@ -1164,11 +1164,11 @@ paths: taskStatuses: - taskIndex: 0 taskState: SUCCEEDED - '404': - $ref: '#/components/responses/NoJobError' - '500': - $ref: '#/components/responses/UnknownError' - '/api/v2/jobs/{user}~{job}/config': + "404": + $ref: "#/components/responses/NoJobError" + "500": + $ref: "#/components/responses/UnknownError" + "/api/v2/jobs/{user}~{job}/config": get: tags: - job @@ -1178,17 +1178,17 @@ paths: security: - bearerAuth: [] parameters: - - $ref: '#/components/parameters/user' - - $ref: '#/components/parameters/job' + - $ref: "#/components/parameters/user" + - $ref: "#/components/parameters/job" responses: - '200': + "200": description: Succeeded content: text/yaml: schema: - $ref: '#/components/schemas/JobProtocol' + $ref: "#/components/schemas/JobProtocol" example: - protocolVersion: '2' + protocolVersion: "2" name: type: job prerequisites: @@ -1205,20 +1205,20 @@ paths: gpu: 1 commands: - python - '404': + "404": description: NoJobError or NoJobConfigError content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: NoJobError: - $ref: '#/components/responses/NoJobError/content/application~1json/examples/NoJobError' + $ref: "#/components/responses/NoJobError/content/application~1json/examples/NoJobError" NoJobConfigError: - $ref: '#/components/responses/NoJobConfigError/content/application~1json/examples/NoJobConfigError' - '500': - $ref: '#/components/responses/UnknownError' - '/api/v2/jobs/{user}~{job}/executionType': + $ref: "#/components/responses/NoJobConfigError/content/application~1json/examples/NoJobConfigError" + "500": + $ref: "#/components/responses/UnknownError" + "/api/v2/jobs/{user}~{job}/executionType": put: tags: - job @@ -1228,8 +1228,8 @@ paths: security: - bearerAuth: [] parameters: - - $ref: '#/components/parameters/user' - - $ref: '#/components/parameters/job' + - $ref: "#/components/parameters/user" + - $ref: "#/components/parameters/job" requestBody: description: Execution type content: @@ -1247,19 +1247,19 @@ paths: - value required: true responses: - '202': + "202": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" example: message: execute job {job} successfully - '404': - $ref: '#/components/responses/NoJobError' - '500': - $ref: '#/components/responses/UnknownError' - '/api/v2/jobs/{user}~{job}/job-attempts/healthz': + "404": + $ref: "#/components/responses/NoJobError" + "500": + $ref: "#/components/responses/UnknownError" + "/api/v2/jobs/{user}~{job}/job-attempts/healthz": get: tags: - job history @@ -1269,14 +1269,14 @@ paths: security: - bearerAuth: [] parameters: - - $ref: '#/components/parameters/user' - - $ref: '#/components/parameters/job' + - $ref: "#/components/parameters/user" + - $ref: "#/components/parameters/job" responses: - '200': + "200": description: OK - '501': + "501": description: Not healthy - '/api/v2/jobs/{user}~{job}/job-attempts': + "/api/v2/jobs/{user}~{job}/job-attempts": get: tags: - job history @@ -1286,17 +1286,17 @@ paths: security: - bearerAuth: [] parameters: - - $ref: '#/components/parameters/user' - - $ref: '#/components/parameters/job' + - $ref: "#/components/parameters/user" + - $ref: "#/components/parameters/job" responses: - '200': + "200": description: Succeeded content: application/json: schema: type: array items: - $ref: '#/components/schemas/JobAttempt' + $ref: "#/components/schemas/JobAttempt" description: job attempts example: - jobName: jobName @@ -1317,7 +1317,7 @@ paths: diagnosticsSummary: Pod succeeded runtime: launcher: Pod succeeded - appExitTriggerMessage: 'All Tasks are completed' + appExitTriggerMessage: "All Tasks are completed" appExitTriggerTaskRoleName: taskrole appExitTriggerTaskIndex: 0 appExitSpec: @@ -1350,11 +1350,11 @@ paths: containerIp: containerExitCode: 0 isLatest: true - '404': - $ref: '#/components/responses/NoJobError' - '501': - $ref: '#/components/responses/UnknownError' - '/api/v2/jobs/{user}~{job}/job-attempts/{attemptIndex}': + "404": + $ref: "#/components/responses/NoJobError" + "501": + $ref: "#/components/responses/UnknownError" + "/api/v2/jobs/{user}~{job}/job-attempts/{attemptIndex}": get: tags: - job history @@ -1364,16 +1364,16 @@ paths: security: - bearerAuth: [] parameters: - - $ref: '#/components/parameters/user' - - $ref: '#/components/parameters/job' - - $ref: '#/components/parameters/attemptIndex' + - $ref: "#/components/parameters/user" + - $ref: "#/components/parameters/job" + - $ref: "#/components/parameters/attemptIndex" responses: - '200': + "200": description: Succeeded content: application/json: schema: - $ref: '#/components/schemas/JobAttempt' + $ref: "#/components/schemas/JobAttempt" example: jobName: jobName frameworkName: frameworkName @@ -1393,7 +1393,7 @@ paths: diagnosticsSummary: Pod succeeded runtime: launcher: Pod succeeded - appExitTriggerMessage: 'All Tasks are completed' + appExitTriggerMessage: "All Tasks are completed" appExitTriggerTaskRoleName: taskrole appExitTriggerTaskIndex: 0 appExitSpec: @@ -1426,10 +1426,10 @@ paths: containerIp: containerExitCode: 0 isLatest: true - '404': - $ref: '#/components/responses/NoJobError' - '501': - $ref: '#/components/responses/UnknownError' + "404": + $ref: "#/components/responses/NoJobError" + "501": + $ref: "#/components/responses/UnknownError" /api/v2/kubernetes/nodes: get: tags: @@ -1440,7 +1440,7 @@ paths: security: - bearerAuth: [] responses: - '200': + "200": description: Succeeded content: application/json: @@ -1448,10 +1448,10 @@ paths: - Please refer to Kubernetes API doc - >- https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#list-node-v1-core - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '403': - $ref: '#/components/responses/ForbiddenUserError' + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "403": + $ref: "#/components/responses/ForbiddenUserError" /api/v2/kubernetes/pods: get: tags: @@ -1468,7 +1468,7 @@ paths: security: - bearerAuth: [] responses: - '200': + "200": description: Succeeded content: application/json: @@ -1476,10 +1476,10 @@ paths: - Please refer to Kubernetes API doc - >- https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#list-all-namespaces-pod-v1-core - '401': - $ref: '#/components/responses/UnauthorizedUserError' - '403': - $ref: '#/components/responses/ForbiddenUserError' + "401": + $ref: "#/components/responses/UnauthorizedUserError" + "403": + $ref: "#/components/responses/ForbiddenUserError" components: parameters: token: @@ -1524,7 +1524,7 @@ components: framework: name: framework in: path - description: 'framework name defined by {user}~{job}' + description: "framework name defined by {user}~{job}" required: true schema: type: string @@ -1971,10 +1971,16 @@ components: type: string reaction: type: string + reason: + type: string repro: type: array items: type: string + solution: + type: array + items: + type: string appExitDiagnostics: type: string nullable: true @@ -2065,6 +2071,10 @@ components: type: string nullable: true description: ip of the task container + containerNodeName: + type: string + nullable: true + description: node name of task container containerPorts: type: object description: ports of the task container @@ -2079,6 +2089,68 @@ components: type: integer nullable: true description: exit code the task container + containerExitSpec: + type: object + nullable: true + description: container exit spec + properties: + code: + type: integer + phrase: + type: string + issuer: + type: string + causer: + type: string + type: + type: string + stage: + type: string + behavior: + type: string + reaction: + type: string + reason: + type: string + repro: + type: array + items: + type: string + solution: + type: array + items: + type: string + containerExitDiagnostics: + type: string + nullable: true + description: container exit diagnostics + retries: + type: integer + accountableRetries: + type: integer + createdTime: + type: integer + description: >- + task created time, in number of milliseconds since the Unix + Epoch. + completedTime: + type: integer + description: >- + task completion time, in number of milliseconds since the Unix + Epoch. + currentAttemptLaunchedTime: + type: integer + description: >- + the current attempt launched time, in number of milliseconds since the Unix + Epoch. + currentAttemptCompletedTime: + type: integer + description: >- + the current attempt completion time, in number of milliseconds since the Unix + Epoch. + hived: + type: object + nullable: true required: - taskRoleStatus - taskStatuses @@ -2508,7 +2580,7 @@ components: content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: IncorrectPasswordError: value: @@ -2519,40 +2591,40 @@ components: content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: NoVirtualClusterError: value: code: NoVirtualClusterError - message: 'Virtual cluster {vc} is not found.' + message: "Virtual cluster {vc} is not found." NoGroupError: description: NoGroupError content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: NoGroupError: value: code: NoGroupError - message: 'Group {groupname} is not found.' + message: "Group {groupname} is not found." NoStorageError: description: NoStorageError content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: NoVirtualClusterError: value: code: NoStorageError - message: 'Storage {storage} is not found.' + message: "Storage {storage} is not found." UnauthorizedUserError: description: UnauthorizedUserError content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: UnauthorizedUserError: value: @@ -2563,7 +2635,7 @@ components: content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: ForbiddenUserError: value: @@ -2578,7 +2650,7 @@ components: content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: ForbiddenKeyError: value: @@ -2589,73 +2661,73 @@ components: content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: NoUserError: value: code: NoUserError - message: 'User {user} is not found.' + message: "User {user} is not found." NoJobError: description: NoJobError content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: NoJobError: value: code: NoJobError - message: 'Job {job} is not found.' + message: "Job {job} is not found." NoJobConfigError: description: NoJobConfigError content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: NoJobConfigError: value: code: NoJobConfigError - message: 'Config of job {job} is not found.' + message: "Config of job {job} is not found." NoJobSshInfoError: description: NoJobSshInfoError content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: NoJobSshInfoError: value: code: NoJobSshInfoError - message: 'SSH info of job {job} is not found.' + message: "SSH info of job {job} is not found." ConflictUserError: description: ConflictUserError content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: ConflictUserError: value: code: ConflictUserError - message: 'User name {user} already exists.' + message: "User name {user} already exists." ConflictJobError: description: ConflictJobError content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: ConflictJobError: value: code: ConflictJobError - message: 'Job name {job} already exists.' + message: "Job name {job} already exists." UnknownError: description: UnknownError content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" examples: UnknownError: value: diff --git a/src/rest-server/src/models/v2/job/k8s.js b/src/rest-server/src/models/v2/job/k8s.js index ae18ca1644..48da0e221f 100644 --- a/src/rest-server/src/models/v2/job/k8s.js +++ b/src/rest-server/src/models/v2/job/k8s.js @@ -213,6 +213,8 @@ const convertTaskDetail = async (taskStatus, ports, logPathPrefix) => { const containerGpus = null; const completionStatus = taskStatus.attemptStatus.completionStatus; + const diagnostics = completionStatus ? completionStatus.diagnostics : null; + const exitDiagnostics = generateExitDiagnostics(diagnostics); return { taskIndex: taskStatus.index, taskState: convertState( @@ -222,10 +224,19 @@ const convertTaskDetail = async (taskStatus, ports, logPathPrefix) => { ), containerId: taskStatus.attemptStatus.podUID, containerIp: taskStatus.attemptStatus.podHostIP, + containerNodeName: taskStatus.attemptStatus.podNodeName, containerPorts, containerGpus, containerLog: `http://${taskStatus.attemptStatus.podHostIP}:${process.env.LOG_MANAGER_PORT}/log-manager/tail/${logPathPrefix}/${taskStatus.attemptStatus.podUID}/`, containerExitCode: completionStatus ? completionStatus.code : null, + containerExitSpec: completionStatus ? generateExitSpec(completionStatus.code) : generateExitSpec(null), + containerExitDiagnostics: exitDiagnostics ? exitDiagnostics.diagnosticsSummary : null, + retries: taskStatus.retryPolicyStatus.totalRetriedCount, + accountableRetries: taskStatus.retryPolicyStatus.accountableRetriedCount, + createdTime: new Date(taskStatus.startTime).getTime(), + completedTime: new Date(taskStatus.completionTime).getTime(), + currentAttemptLaunchedTime: new Date(taskStatus.attemptStatus.runTime || taskStatus.attemptStatus.startTime).getTime(), + currentAttemptCompletedTime: new Date(taskStatus.attemptStatus.completionTime).getTime(), ...launcherConfig.enabledHived && { hived: { affinityGroupName, diff --git a/src/webportal/src/app/job/job-submit-v1/job-submit.component.js b/src/webportal/src/app/job/job-submit-v1/job-submit.component.js index 9c1dfc0ea5..95241e35c5 100644 --- a/src/webportal/src/app/job/job-submit-v1/job-submit.component.js +++ b/src/webportal/src/app/job/job-submit-v1/job-submit.component.js @@ -96,7 +96,7 @@ const submitJob = jobConfig => { const user = cookies.get('user'); loading.showLoading(); $.ajax({ - url: `${webportalConfig.restServerUri}/api/v1/jobs/${user}~${jobConfig.jobName}`, + url: `${webportalConfig.restServerUri}/api/v2/jobs/${user}~${jobConfig.jobName}`, data: JSON.stringify(jobConfig), headers: { Authorization: `Bearer ${token}`, @@ -205,7 +205,7 @@ $(document).ready(() => { if (type != null && username != null && jobName != null) { const url = username === '' - ? `${webportalConfig.restServerUri}/api/v1/jobs/${jobName}/config` + ? `${webportalConfig.restServerUri}/api/v2/jobs/${jobName}/config` : `${webportalConfig.restServerUri}/api/v2/jobs/${username}~${jobName}/config`; $.ajax({ url: url,