Merge branch 'master' into import-data-sanitation

This commit is contained in:
Jan Eitzinger
2023-04-07 08:57:42 +02:00
110 changed files with 8191 additions and 1464 deletions

View File

@@ -10,6 +10,7 @@ type Job {
jobId: Int!
user: String!
project: String!
jobName: String
cluster: String!
subCluster: String!
startTime: Time!
@@ -212,6 +213,7 @@ input JobFilter {
arrayJobId: Int
user: StringInput
project: StringInput
jobName: StringInput
cluster: StringInput
partition: StringInput
duration: IntRange
@@ -245,6 +247,7 @@ input StringInput {
contains: String
startsWith: String
endsWith: String
in: [String!]
}
input IntRange { from: Int!, to: Int! }
@@ -265,6 +268,7 @@ type HistoPoint {
type JobsStatistics {
id: ID! # If `groupBy` was used, ID of the user/project/cluster
name: String # if User-Statistics: Given Name of Account (ID) Owner
totalJobs: Int! # Number of jobs that matched
shortJobs: Int! # Number of jobs with a duration of less than 2 minutes
totalWalltime: Int! # Sum of the duration of all matched jobs in hours

View File

@@ -1,9 +1,8 @@
{
"swagger": "2.0",
"info": {
"description": "Defines a tag using name and type.",
"description": "API for batch job control.",
"title": "ClusterCockpit REST API",
"termsOfService": "https://monitoring.nhr.fau.de/imprint",
"contact": {
"name": "ClusterCockpit Project",
"url": "https://github.com/ClusterCockpit",
@@ -13,9 +12,9 @@
"name": "MIT License",
"url": "https://opensource.org/licenses/MIT"
},
"version": "0.1.0"
"version": "0.2.0"
},
"host": "clustercockpit.localhost:8082",
"host": "localhost:8080",
"basePath": "/api",
"paths": {
"/jobs/": {
@@ -26,12 +25,12 @@
}
],
"description": "Get a list of all jobs. Filters can be applied using query parameters.\nNumber of results can be limited by page. Results are sorted by descending startTime.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"query"
],
"summary": "Lists all jobs",
"parameters": [
{
@@ -62,13 +61,13 @@
},
{
"type": "integer",
"description": "Items per page (If empty: No Limit)",
"description": "Items per page (Default: 25)",
"name": "items-per-page",
"in": "query"
},
{
"type": "integer",
"description": "Page Number (If empty: No Paging)",
"description": "Page Number (Default: 1)",
"name": "page",
"in": "query"
},
@@ -81,12 +80,9 @@
],
"responses": {
"200": {
"description": "Array of matching jobs",
"description": "Job array and page info",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/schema.Job"
}
"$ref": "#/definitions/api.GetJobsApiResponse"
}
},
"400": {
@@ -101,6 +97,227 @@
"$ref": "#/definitions/api.ErrorResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
}
}
}
},
"/jobs/delete_job/": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Job to delete is specified by request body. All fields are required in this case.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"remove"
],
"summary": "Remove a job from the sql database",
"parameters": [
{
"description": "All fields required",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.DeleteJobApiRequest"
}
}
],
"responses": {
"200": {
"description": "Success message",
"schema": {
"$ref": "#/definitions/api.DeleteJobApiResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"404": {
"description": "Resource not found",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"422": {
"description": "Unprocessable Entity: finding job failed: sql: no rows in result set",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
}
}
}
},
"/jobs/delete_job/{id}": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Job to remove is specified by database ID. This will not remove the job from the job archive.",
"produces": [
"application/json"
],
"tags": [
"remove"
],
"summary": "Remove a job from the sql database",
"parameters": [
{
"type": "integer",
"description": "Database ID of Job",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Success message",
"schema": {
"$ref": "#/definitions/api.DeleteJobApiResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"404": {
"description": "Resource not found",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"422": {
"description": "Unprocessable Entity: finding job failed: sql: no rows in result set",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
}
}
}
},
"/jobs/delete_job_before/{ts}": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Remove all jobs with start time before timestamp. The jobs will not be removed from the job archive.",
"produces": [
"application/json"
],
"tags": [
"remove"
],
"summary": "Remove a job from the sql database",
"parameters": [
{
"type": "integer",
"description": "Unix epoch timestamp",
"name": "ts",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Success message",
"schema": {
"$ref": "#/definitions/api.DeleteJobApiResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"404": {
"description": "Resource not found",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"422": {
"description": "Unprocessable Entity: finding job failed: sql: no rows in result set",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
@@ -124,6 +341,9 @@
"produces": [
"application/json"
],
"tags": [
"add and modify"
],
"summary": "Adds a new job as \"running\"",
"parameters": [
{
@@ -187,6 +407,9 @@
"produces": [
"application/json"
],
"tags": [
"add and modify"
],
"summary": "Marks job as completed and triggers archiving",
"parameters": [
{
@@ -201,7 +424,7 @@
],
"responses": {
"200": {
"description": "Job resource",
"description": "Success message",
"schema": {
"$ref": "#/definitions/schema.JobMeta"
}
@@ -259,6 +482,9 @@
"produces": [
"application/json"
],
"tags": [
"add and modify"
],
"summary": "Marks job as completed and triggers archiving",
"parameters": [
{
@@ -338,6 +564,9 @@
"produces": [
"application/json"
],
"tags": [
"add and modify"
],
"summary": "Adds one or more tags to a job",
"parameters": [
{
@@ -355,7 +584,7 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/api.Tag"
"$ref": "#/definitions/api.ApiTag"
}
}
}
@@ -396,8 +625,53 @@
}
},
"definitions": {
"api.ApiTag": {
"type": "object",
"properties": {
"name": {
"description": "Tag Name",
"type": "string",
"example": "Testjob"
},
"type": {
"description": "Tag Type",
"type": "string",
"example": "Debug"
}
}
},
"api.DeleteJobApiRequest": {
"type": "object",
"required": [
"jobId"
],
"properties": {
"cluster": {
"description": "Cluster of job",
"type": "string",
"example": "fritz"
},
"jobId": {
"description": "Cluster Job ID of job",
"type": "integer",
"example": 123000
},
"startTime": {
"description": "Start Time of job as epoch",
"type": "integer",
"example": 1649723812
}
}
},
"api.DeleteJobApiResponse": {
"type": "object",
"properties": {
"msg": {
"type": "string"
}
}
},
"api.ErrorResponse": {
"description": "Error message as returned from backend.",
"type": "object",
"properties": {
"error": {
@@ -410,8 +684,27 @@
}
}
},
"api.GetJobsApiResponse": {
"type": "object",
"properties": {
"items": {
"description": "Number of jobs returned",
"type": "integer"
},
"jobs": {
"description": "Array of jobs",
"type": "array",
"items": {
"$ref": "#/definitions/schema.JobMeta"
}
},
"page": {
"description": "Page id returned",
"type": "integer"
}
}
},
"api.StartJobApiResponse": {
"description": "Successful job start response with database id of new job.",
"type": "object",
"properties": {
"id": {
@@ -421,7 +714,6 @@
}
},
"api.StopJobApiRequest": {
"description": "Request to stop running job using stoptime and final state. They are only required if no database id was provided with endpoint.",
"type": "object",
"required": [
"jobState",
@@ -439,14 +731,11 @@
"example": 123000
},
"jobState": {
"description": "Final state of job",
"type": "string",
"enum": [
"completed",
"failed",
"cancelled",
"stopped",
"timeout"
"description": "Final job state",
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed"
},
@@ -462,22 +751,6 @@
}
}
},
"api.Tag": {
"description": "Defines a tag using name and type.",
"type": "object",
"properties": {
"name": {
"description": "Tag Name",
"type": "string",
"example": "Testjob"
},
"type": {
"description": "Tag Type",
"type": "string",
"example": "Debug"
}
}
},
"schema.Job": {
"description": "Information of a HPC job.",
"type": "object",
@@ -516,14 +789,10 @@
},
"jobState": {
"description": "Final state of job",
"type": "string",
"enum": [
"completed",
"failed",
"cancelled",
"stopped",
"timeout",
"out_of_memory"
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed"
},
@@ -648,14 +917,10 @@
},
"jobState": {
"description": "Final state of job",
"type": "string",
"enum": [
"completed",
"failed",
"cancelled",
"stopped",
"timeout",
"out_of_memory"
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed"
},
@@ -751,6 +1016,29 @@
}
}
},
"schema.JobState": {
"type": "string",
"enum": [
"running",
"completed",
"failed",
"cancelled",
"stopped",
"timeout",
"preempted",
"out_of_memory"
],
"x-enum-varnames": [
"JobStateRunning",
"JobStateCompleted",
"JobStateFailed",
"JobStateCancelled",
"JobStateStopped",
"JobStateTimeout",
"JobStatePreempted",
"JobStateOutOfMemory"
]
},
"schema.JobStatistics": {
"description": "Specification for job metric statistics.",
"type": "object",
@@ -831,10 +1119,14 @@
},
"securityDefinitions": {
"ApiKeyAuth": {
"description": "JWT based authentification for general API endpoint use.",
"type": "apiKey",
"name": "X-Auth-Token",
"in": "header"
}
}
},
"tags": [
{
"name": "Job API"
}
]
}

View File

@@ -1,7 +1,39 @@
basePath: /api
definitions:
api.ApiTag:
properties:
name:
description: Tag Name
example: Testjob
type: string
type:
description: Tag Type
example: Debug
type: string
type: object
api.DeleteJobApiRequest:
properties:
cluster:
description: Cluster of job
example: fritz
type: string
jobId:
description: Cluster Job ID of job
example: 123000
type: integer
startTime:
description: Start Time of job as epoch
example: 1649723812
type: integer
required:
- jobId
type: object
api.DeleteJobApiResponse:
properties:
msg:
type: string
type: object
api.ErrorResponse:
description: Error message as returned from backend.
properties:
error:
description: Error Message
@@ -10,16 +42,27 @@ definitions:
description: Statustext of Errorcode
type: string
type: object
api.GetJobsApiResponse:
properties:
items:
description: Number of jobs returned
type: integer
jobs:
description: Array of jobs
items:
$ref: '#/definitions/schema.JobMeta'
type: array
page:
description: Page id returned
type: integer
type: object
api.StartJobApiResponse:
description: Successful job start response with database id of new job.
properties:
id:
description: Database ID of new job
type: integer
type: object
api.StopJobApiRequest:
description: Request to stop running job using stoptime and final state. They
are only required if no database id was provided with endpoint.
properties:
cluster:
description: Cluster of job
@@ -30,15 +73,10 @@ definitions:
example: 123000
type: integer
jobState:
description: Final state of job
enum:
- completed
- failed
- cancelled
- stopped
- timeout
allOf:
- $ref: '#/definitions/schema.JobState'
description: Final job state
example: completed
type: string
startTime:
description: Start Time of job as epoch
example: 1649723812
@@ -51,18 +89,6 @@ definitions:
- jobState
- stopTime
type: object
api.Tag:
description: Defines a tag using name and type.
properties:
name:
description: Tag Name
example: Testjob
type: string
type:
description: Tag Type
example: Debug
type: string
type: object
schema.Job:
description: Information of a HPC job.
properties:
@@ -95,16 +121,10 @@ definitions:
example: 123000
type: integer
jobState:
allOf:
- $ref: '#/definitions/schema.JobState'
description: Final state of job
enum:
- completed
- failed
- cancelled
- stopped
- timeout
- out_of_memory
example: completed
type: string
metaData:
additionalProperties:
type: string
@@ -203,16 +223,10 @@ definitions:
example: 123000
type: integer
jobState:
allOf:
- $ref: '#/definitions/schema.JobState'
description: Final state of job
enum:
- completed
- failed
- cancelled
- stopped
- timeout
- out_of_memory
example: completed
type: string
metaData:
additionalProperties:
type: string
@@ -286,6 +300,26 @@ definitions:
minimum: 1
type: integer
type: object
schema.JobState:
enum:
- running
- completed
- failed
- cancelled
- stopped
- timeout
- preempted
- out_of_memory
type: string
x-enum-varnames:
- JobStateRunning
- JobStateCompleted
- JobStateFailed
- JobStateCancelled
- JobStateStopped
- JobStateTimeout
- JobStatePreempted
- JobStateOutOfMemory
schema.JobStatistics:
description: Specification for job metric statistics.
properties:
@@ -344,24 +378,21 @@ definitions:
example: Debug
type: string
type: object
host: clustercockpit.localhost:8082
host: localhost:8080
info:
contact:
email: support@clustercockpit.org
name: ClusterCockpit Project
url: https://github.com/ClusterCockpit
description: Defines a tag using name and type.
description: API for batch job control.
license:
name: MIT License
url: https://opensource.org/licenses/MIT
termsOfService: https://monitoring.nhr.fau.de/imprint
title: ClusterCockpit REST API
version: 0.1.0
version: 0.2.0
paths:
/jobs/:
get:
consumes:
- application/json
description: |-
Get a list of all jobs. Filters can be applied using query parameters.
Number of results can be limited by page. Results are sorted by descending startTime.
@@ -385,11 +416,11 @@ paths:
in: query
name: start-time
type: string
- description: 'Items per page (If empty: No Limit)'
- description: 'Items per page (Default: 25)'
in: query
name: items-per-page
type: integer
- description: 'Page Number (If empty: No Paging)'
- description: 'Page Number (Default: 1)'
in: query
name: page
type: integer
@@ -401,11 +432,9 @@ paths:
- application/json
responses:
"200":
description: Array of matching jobs
description: Job array and page info
schema:
items:
$ref: '#/definitions/schema.Job'
type: array
$ref: '#/definitions/api.GetJobsApiResponse'
"400":
description: Bad Request
schema:
@@ -414,6 +443,10 @@ paths:
description: Unauthorized
schema:
$ref: '#/definitions/api.ErrorResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/api.ErrorResponse'
"500":
description: Internal Server Error
schema:
@@ -421,6 +454,152 @@ paths:
security:
- ApiKeyAuth: []
summary: Lists all jobs
tags:
- query
/jobs/delete_job/:
delete:
consumes:
- application/json
description: Job to delete is specified by request body. All fields are required
in this case.
parameters:
- description: All fields required
in: body
name: request
required: true
schema:
$ref: '#/definitions/api.DeleteJobApiRequest'
produces:
- application/json
responses:
"200":
description: Success message
schema:
$ref: '#/definitions/api.DeleteJobApiResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/api.ErrorResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/api.ErrorResponse'
"404":
description: Resource not found
schema:
$ref: '#/definitions/api.ErrorResponse'
"422":
description: 'Unprocessable Entity: finding job failed: sql: no rows in
result set'
schema:
$ref: '#/definitions/api.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api.ErrorResponse'
security:
- ApiKeyAuth: []
summary: Remove a job from the sql database
tags:
- remove
/jobs/delete_job/{id}:
delete:
description: Job to remove is specified by database ID. This will not remove
the job from the job archive.
parameters:
- description: Database ID of Job
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: Success message
schema:
$ref: '#/definitions/api.DeleteJobApiResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/api.ErrorResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/api.ErrorResponse'
"404":
description: Resource not found
schema:
$ref: '#/definitions/api.ErrorResponse'
"422":
description: 'Unprocessable Entity: finding job failed: sql: no rows in
result set'
schema:
$ref: '#/definitions/api.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api.ErrorResponse'
security:
- ApiKeyAuth: []
summary: Remove a job from the sql database
tags:
- remove
/jobs/delete_job_before/{ts}:
delete:
description: Remove all jobs with start time before timestamp. The jobs will
not be removed from the job archive.
parameters:
- description: Unix epoch timestamp
in: path
name: ts
required: true
type: integer
produces:
- application/json
responses:
"200":
description: Success message
schema:
$ref: '#/definitions/api.DeleteJobApiResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/api.ErrorResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/api.ErrorResponse'
"404":
description: Resource not found
schema:
$ref: '#/definitions/api.ErrorResponse'
"422":
description: 'Unprocessable Entity: finding job failed: sql: no rows in
result set'
schema:
$ref: '#/definitions/api.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api.ErrorResponse'
security:
- ApiKeyAuth: []
summary: Remove a job from the sql database
tags:
- remove
/jobs/start_job/:
post:
consumes:
@@ -466,6 +645,8 @@ paths:
security:
- ApiKeyAuth: []
summary: Adds a new job as "running"
tags:
- add and modify
/jobs/stop_job/:
post:
description: |-
@@ -482,7 +663,7 @@ paths:
- application/json
responses:
"200":
description: Job resource
description: Success message
schema:
$ref: '#/definitions/schema.JobMeta'
"400":
@@ -513,6 +694,8 @@ paths:
security:
- ApiKeyAuth: []
summary: Marks job as completed and triggers archiving
tags:
- add and modify
/jobs/stop_job/{id}:
post:
consumes:
@@ -567,6 +750,8 @@ paths:
security:
- ApiKeyAuth: []
summary: Marks job as completed and triggers archiving
tags:
- add and modify
/jobs/tag_job/{id}:
post:
consumes:
@@ -586,7 +771,7 @@ paths:
required: true
schema:
items:
$ref: '#/definitions/api.Tag'
$ref: '#/definitions/api.ApiTag'
type: array
produces:
- application/json
@@ -614,10 +799,13 @@ paths:
security:
- ApiKeyAuth: []
summary: Adds one or more tags to a job
tags:
- add and modify
securityDefinitions:
ApiKeyAuth:
description: JWT based authentification for general API endpoint use.
in: header
name: X-Auth-Token
type: apiKey
swagger: "2.0"
tags:
- name: Job API