Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Add job attempt schema in api doc (#4376)
Browse files Browse the repository at this point in the history
  • Loading branch information
debuggy authored Apr 13, 2020
1 parent 84e09d3 commit 8df769f
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 8 deletions.
166 changes: 161 additions & 5 deletions src/rest-server/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,8 @@ paths:
summary: Check if job attempts is healthy.
description: Check if job attempts is healthy.
operationId: getJobAttemptsHealthz
security:
- bearerAuth: []
parameters:
- $ref: '#/components/parameters/user'
- $ref: '#/components/parameters/job'
Expand All @@ -917,6 +919,8 @@ paths:
summary: Get all attempts of a job.
description: Get all attempts of a job.
operationId: getJobAttempts
security:
- bearerAuth: []
parameters:
- $ref: '#/components/parameters/user'
- $ref: '#/components/parameters/job'
Expand All @@ -934,17 +938,19 @@ paths:
$ref: '#/components/responses/NoJobError'
'501':
$ref: '#/components/responses/UnknownError'
'/api/v2/jobs/{user}~{job}/job-attempts/{attempt}':
'/api/v2/jobs/{user}~{job}/job-attempts/{attemptIndex}':
get:
tags:
- job history
summary: Get a specific attempt by attempt index.
description: Get a specific attempt by attempt index.
operationId: getJobAttempt
security:
- bearerAuth: []
parameters:
- $ref: '#/components/parameters/user'
- $ref: '#/components/parameters/job'
- $ref: '#/components/parameters/attempt'
- $ref: '#/components/parameters/attemptIndex'
responses:
'200':
description: Succeeded
Expand Down Expand Up @@ -1061,8 +1067,8 @@ components:
required: true
schema:
type: string
attempt:
name: attempt
attemptIndex:
name: attemptIndex
in: path
description: attempt index
required: true
Expand Down Expand Up @@ -1775,7 +1781,157 @@ components:
- data
JobAttempt:
type: object
description: TODO
description: job attempt
properties:
jobName:
type: string
frameworkName:
type: string
uid:
type: string
userName:
type: string
state:
type: string
originState:
type: string
maxAttemptCount:
type: integer
attemptIndex:
type: integer
jobStartedTime:
type: integer
attemptStartedTime:
type: integer
attemptCompletedTime:
type: integer
exitCode:
type: integer
exitPhrase:
type: string
exitType:
type: string
exitDiagnostics:
type: object
properties:
diagnosticsSummary:
type: string
runtime:
type: object
properties:
exitCode:
type: integer
originUserExitCode:
type: integer
errorLogs:
type: object
properties:
user:
type: string
platform:
type: string
name:
type: string
launcher:
type: string
appExitTriggerMessage:
type: string
appExitTriggerTaskRoleName:
type: string
appExitTriggerTaskIndex:
type: integer
appExitSpec:
type: object
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
appExitDiagnostics:
type: string
appExitMessages:
type: object
properties:
container:
type: string
runtime:
type: object
properties:
exitCode:
type: integer
originUserExitCode:
type: integer
errorLogs:
type: object
properties:
user:
type: string
platform:
type: string
name:
type: string
launcher:
type: string
totalGpuNumber:
type: integer
totalTasknumber:
type: integer
totalTaskRoleNumber:
type: integer
taskRoles:
type: object
properties:
taskrole:
type: object
properties:
taskRoleStatus:
type: object
properties:
name:
type: string
taskStatuses:
type: array
items:
type: object
properties:
taskIndex:
type: integer
taskState:
type: string
containerId:
type: string
containerIp:
type: string
containerGpus:
type: string
containerLog:
type: string
containerExitCode:
type: integer
isLatest:
type: boolean
responses:
IncorrectPassworkError:
description: IncorrectPassworkError
Expand Down
7 changes: 4 additions & 3 deletions src/rest-server/src/routes/v2/job-attempt.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@
// module dependencies
const express = require('express');
const controller = require('@pai/controllers/v2/job-attempt');
const token = require('@pai/middlewares/token');


const router = new express.Router({mergeParams: true});

/** GET /api/v2/jobs/:frameworkName/job-attempts/healthz - health check of job retry endpoint*/
router.route('/healthz')
.get(controller.healthCheck);
.get(token.check, controller.healthCheck);

/** GET /api/v2/jobs/:frameworkName/job-attempts - list job retries by job frameworkName */
router.route('/')
.get(controller.list);
.get(token.check, controller.list);

/** GET /api/v2/jobs/:frameworkName/job-attempts/:jobAttemptIndex - get certain job retry by retry index */
router.route('/:jobAttemptIndex')
.get(controller.get);
.get(token.check, controller.get);

module.exports = router;

0 comments on commit 8df769f

Please sign in to comment.