Merge branch 'master' into 40_45_82_update_roles

This commit is contained in:
Christoph Kluge 2023-02-22 09:28:41 +01:00
commit 48728e64c4
7 changed files with 109 additions and 82 deletions

View File

@ -104,7 +104,7 @@ Every cc-backend version supports a specific database version.
On startup the version of the sqlite database is validated and cc-backend will terminate if the version does not match.
cc-backend supports to migrate the database schema up to the required version using the `--migrate-db` command line option.
In case the database file does not yet exist it is created and initialized by the `--migrate-db` command line option.
In case you want to use a newer database version with an olden version of cc-backend you can downgrade a database using the external [migrate](https://github.com/golang-migrate/migrate) tool.
In case you want to use a newer database version with an older version of cc-backend you can downgrade a database using the external [migrate](https://github.com/golang-migrate/migrate) tool.
In this case you have to provide the path to the migration files in a recent source tree: `./internal/repository/migrations/`.
## Development

View File

@ -708,8 +708,7 @@
"example": 123000
},
"jobState": {
"description": "Final state of job",
"type": "string",
"description": "Final job state",
"enum": [
"completed",
"failed",
@ -717,6 +716,11 @@
"stopped",
"timeout"
],
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed"
},
"startTime": {
@ -769,7 +773,6 @@
},
"jobState": {
"description": "Final state of job",
"type": "string",
"enum": [
"completed",
"failed",
@ -778,6 +781,11 @@
"timeout",
"out_of_memory"
],
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed"
},
"metaData": {
@ -901,7 +909,6 @@
},
"jobState": {
"description": "Final state of job",
"type": "string",
"enum": [
"completed",
"failed",
@ -910,6 +917,11 @@
"timeout",
"out_of_memory"
],
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed"
},
"metaData": {
@ -1004,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",

View File

@ -59,7 +59,9 @@ definitions:
example: 123000
type: integer
jobState:
description: Final state of job
allOf:
- $ref: '#/definitions/schema.JobState'
description: Final job state
enum:
- completed
- failed
@ -67,7 +69,6 @@ definitions:
- stopped
- timeout
example: completed
type: string
startTime:
description: Start Time of job as epoch
example: 1649723812
@ -112,6 +113,8 @@ definitions:
example: 123000
type: integer
jobState:
allOf:
- $ref: '#/definitions/schema.JobState'
description: Final state of job
enum:
- completed
@ -121,7 +124,6 @@ definitions:
- timeout
- out_of_memory
example: completed
type: string
metaData:
additionalProperties:
type: string
@ -220,6 +222,8 @@ definitions:
example: 123000
type: integer
jobState:
allOf:
- $ref: '#/definitions/schema.JobState'
description: Final state of job
enum:
- completed
@ -229,7 +233,6 @@ definitions:
- timeout
- out_of_memory
example: completed
type: string
metaData:
additionalProperties:
type: string
@ -303,6 +306,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:

View File

@ -1,5 +1,4 @@
// Package api GENERATED BY SWAG; DO NOT EDIT
// This file was generated by swaggo/swag
// Code generated by swaggo/swag. DO NOT EDIT
package api
import "github.com/swaggo/swag"
@ -715,8 +714,7 @@ const docTemplate = `{
"example": 123000
},
"jobState": {
"description": "Final state of job",
"type": "string",
"description": "Final job state",
"enum": [
"completed",
"failed",
@ -724,6 +722,11 @@ const docTemplate = `{
"stopped",
"timeout"
],
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed"
},
"startTime": {
@ -776,7 +779,6 @@ const docTemplate = `{
},
"jobState": {
"description": "Final state of job",
"type": "string",
"enum": [
"completed",
"failed",
@ -785,6 +787,11 @@ const docTemplate = `{
"timeout",
"out_of_memory"
],
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed"
},
"metaData": {
@ -908,7 +915,6 @@ const docTemplate = `{
},
"jobState": {
"description": "Final state of job",
"type": "string",
"enum": [
"completed",
"failed",
@ -917,6 +923,11 @@ const docTemplate = `{
"timeout",
"out_of_memory"
],
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed"
},
"metaData": {
@ -1011,6 +1022,29 @@ const docTemplate = `{
}
}
},
"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",

View File

@ -5495,7 +5495,6 @@ func (ec *executionContext) _Mutation_createTag(ctx context.Context, field graph
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
@ -5558,7 +5557,6 @@ func (ec *executionContext) _Mutation_deleteTag(ctx context.Context, field graph
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
@ -5613,7 +5611,6 @@ func (ec *executionContext) _Mutation_addTagsToJob(ctx context.Context, field gr
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
@ -5676,7 +5673,6 @@ func (ec *executionContext) _Mutation_removeTagsFromJob(ctx context.Context, fie
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
@ -5739,7 +5735,6 @@ func (ec *executionContext) _Mutation_updateConfiguration(ctx context.Context, f
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
@ -5929,7 +5924,6 @@ func (ec *executionContext) _Query_clusters(ctx context.Context, field graphql.C
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
@ -5983,7 +5977,6 @@ func (ec *executionContext) _Query_tags(ctx context.Context, field graphql.Colle
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
@ -6035,7 +6028,6 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
@ -6097,7 +6089,6 @@ func (ec *executionContext) _Query_allocatedNodes(ctx context.Context, field gra
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
@ -6158,7 +6149,6 @@ func (ec *executionContext) _Query_job(ctx context.Context, field graphql.Collec
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
@ -6258,7 +6248,6 @@ func (ec *executionContext) _Query_jobMetrics(ctx context.Context, field graphql
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
@ -6319,7 +6308,6 @@ func (ec *executionContext) _Query_jobsFootprints(ctx context.Context, field gra
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
@ -6377,7 +6365,6 @@ func (ec *executionContext) _Query_jobs(ctx context.Context, field graphql.Colle
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
@ -6442,7 +6429,6 @@ func (ec *executionContext) _Query_jobsStatistics(ctx context.Context, field gra
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
@ -6515,7 +6501,6 @@ func (ec *executionContext) _Query_jobsCount(ctx context.Context, field graphql.
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
@ -6576,7 +6561,6 @@ func (ec *executionContext) _Query_rooflineHeatmap(ctx context.Context, field gr
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
@ -6631,7 +6615,6 @@ func (ec *executionContext) _Query_nodeMetrics(ctx context.Context, field graphq
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
@ -6694,7 +6677,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
@ -6768,7 +6750,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
@ -11671,7 +11652,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
})
out := graphql.NewFieldSet(fields)
var invalids uint32
for i, field := range fields {
innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{
Object: field.Name,
@ -11687,36 +11667,24 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
return ec._Mutation_createTag(ctx, field)
})
if out.Values[i] == graphql.Null {
invalids++
}
case "deleteTag":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._Mutation_deleteTag(ctx, field)
})
if out.Values[i] == graphql.Null {
invalids++
}
case "addTagsToJob":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._Mutation_addTagsToJob(ctx, field)
})
if out.Values[i] == graphql.Null {
invalids++
}
case "removeTagsFromJob":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._Mutation_removeTagsFromJob(ctx, field)
})
if out.Values[i] == graphql.Null {
invalids++
}
case "updateConfiguration":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
@ -11728,9 +11696,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
}
}
out.Dispatch()
if invalids > 0 {
return graphql.Null
}
return out
}
@ -11785,7 +11750,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
})
out := graphql.NewFieldSet(fields)
var invalids uint32
for i, field := range fields {
innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{
Object: field.Name,
@ -11805,9 +11769,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
}
}()
res = ec._Query_clusters(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res
}
@ -11828,9 +11789,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
}
}()
res = ec._Query_tags(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res
}
@ -11871,9 +11829,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
}
}()
res = ec._Query_allocatedNodes(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res
}
@ -11914,9 +11869,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
}
}()
res = ec._Query_jobMetrics(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res
}
@ -11957,9 +11909,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
}
}()
res = ec._Query_jobs(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res
}
@ -11980,9 +11929,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
}
}()
res = ec._Query_jobsStatistics(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res
}
@ -12003,9 +11949,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
}
}()
res = ec._Query_jobsCount(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res
}
@ -12026,9 +11969,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
}
}()
res = ec._Query_rooflineHeatmap(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res
}
@ -12049,9 +11989,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
}
}()
res = ec._Query_nodeMetrics(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res
}
@ -12079,9 +12016,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
}
}
out.Dispatch()
if invalids > 0 {
return graphql.Null
}
return out
}

View File

@ -2,6 +2,7 @@ package graph
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen version v0.17.24
import (
"context"

View File

@ -915,7 +915,7 @@ func (r *JobRepository) JobsStatistics(ctx context.Context,
}
if col == "job.user" {
for id, _ := range stats {
for id := range stats {
emptyDash := "-"
name, _ := r.FindNameByUser(ctx, id)
if name != "" {