Merge branch 'dev-job-archive-module' of github.com:ClusterCockpit/cc-backend into dev-job-archive-module

This commit is contained in:
Jan Eitzinger 2022-09-16 06:28:07 +02:00
commit 6325f02ba2
5 changed files with 188 additions and 6 deletions

View File

@ -508,4 +508,4 @@
"in": "header"
}
}
}
}

View File

@ -89,6 +89,73 @@ definitions:
walltime:
type: integer
type: object
schema.JobMeta:
properties:
arrayJobId:
type: integer
cluster:
type: string
duration:
type: integer
exclusive:
type: integer
id:
description: never used in the job-archive, only available via REST-API
type: integer
jobId:
type: integer
jobState:
type: string
metaData:
additionalProperties:
type: string
type: object
monitoringStatus:
type: integer
numAcc:
type: integer
numHwthreads:
type: integer
numNodes:
type: integer
partition:
type: string
project:
type: string
resources:
items:
$ref: '#/definitions/schema.Resource'
type: array
smt:
type: integer
startTime:
type: integer
statistics:
additionalProperties:
$ref: '#/definitions/schema.JobStatistics'
type: object
subCluster:
type: string
tags:
items:
$ref: '#/definitions/schema.Tag'
type: array
user:
type: string
walltime:
type: integer
type: object
schema.JobStatistics:
properties:
avg:
type: number
max:
type: number
min:
type: number
unit:
type: string
type: object
schema.Resource:
properties:
accelerators:
@ -196,7 +263,7 @@ paths:
name: request
required: true
schema:
$ref: '#/definitions/schema.Job'
$ref: '#/definitions/schema.JobMeta'
produces:
- application/json
responses:

View File

@ -263,7 +263,6 @@ func main() {
if flagDev {
r.Handle("/playground", playground.Handler("GraphQL playground", "/query"))
// secured.PathPrefix("/docs").Handler(httpSwagger.WrapHandler)
r.PathPrefix("/swagger/").Handler(httpSwagger.Handler(
httpSwagger.URL("http://localhost:8080/swagger/doc.json"))).Methods(http.MethodGet)
}

View File

@ -133,7 +133,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/schema.Job"
"$ref": "#/definitions/schema.JobMeta"
}
}
],
@ -392,6 +392,21 @@ const docTemplate = `{
}
}
},
<<<<<<< HEAD:internal/api/docs.go
=======
"api.TagJobApiRequest": {
"description": "Request to tag a job.",
"type": "array",
"items": {
"type": "object",
"properties": {
"error": {
"description": "Error Message",
"type": "string"
},
"status": {
"description": "Statustext of Errorcode",
>>>>>>> 922e94e835e2fba068341645df50e7b42734dfb5:docs/docs.go
"schema.Job": {
"type": "object",
"properties": {
@ -469,6 +484,107 @@ const docTemplate = `{
}
}
},
"schema.JobMeta": {
"type": "object",
"properties": {
"arrayJobId": {
"type": "integer"
},
"cluster": {
"type": "string"
},
"duration": {
"type": "integer"
},
"exclusive": {
"type": "integer"
},
"id": {
"description": "never used in the job-archive, only available via REST-API",
"type": "integer"
},
"jobId": {
"type": "integer"
},
"jobState": {
"type": "string"
},
"metaData": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"monitoringStatus": {
"type": "integer"
},
"numAcc": {
"type": "integer"
},
"numHwthreads": {
"type": "integer"
},
"numNodes": {
"type": "integer"
},
"partition": {
"type": "string"
},
"project": {
"type": "string"
},
"resources": {
"type": "array",
"items": {
"$ref": "#/definitions/schema.Resource"
}
},
"smt": {
"type": "integer"
},
"startTime": {
"type": "integer"
},
"statistics": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/schema.JobStatistics"
}
},
"subCluster": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"$ref": "#/definitions/schema.Tag"
}
},
"user": {
"type": "string"
},
"walltime": {
"type": "integer"
}
}
},
"schema.JobStatistics": {
"type": "object",
"properties": {
"avg": {
"type": "number"
},
"max": {
"type": "number"
},
"min": {
"type": "number"
},
"unit": {
"type": "string"
}
}
},
"schema.Resource": {
"type": "object",
"properties": {

View File

@ -325,7 +325,7 @@ func (api *RestApi) tagJob(rw http.ResponseWriter, r *http.Request) {
// @Tags jobs
// @Accept json
// @Produce json
// @Param request body schema.Job true "Job to add"
// @Param request body schema.JobMeta true "Job to add"
// @Success 201 {object} api.StartJobApiResponse "Job added successfully"
// @Failure 400 {object} api.ErrorResponse "Bad Request"
// @Failure 422 {object} api.ErrorResponse "The combination of jobId, clusterId and startTime does already exist"
@ -505,7 +505,7 @@ func (api *RestApi) stopJobById(rw http.ResponseWriter, r *http.Request) {
// @Accept json
// @Produce json
// @Param request body api.StopJobApiRequest true "All fields required"
// @Success 201 {object} schema.Job "Job resource"
// @Success 201 {object} schema.JobMeta "Job resource"
// @Failure 400 {object} api.ErrorResponse "Bad Request"
// @Failure 404 {object} api.ErrorResponse "Resource not found"
// @Security ApiKeyAuth