Adapt Cluster schema

Add remove boolean to subClusterConfig in MetricList.
Fix Linter errors.
This commit is contained in:
Jan Eitzinger 2023-03-21 11:51:11 +01:00
parent 747f6d4e2d
commit 5d526e1168
6 changed files with 1150 additions and 326 deletions

View File

@ -50,7 +50,6 @@ type SubCluster {
flopRateSimd: MetricValue! flopRateSimd: MetricValue!
memoryBandwidth: MetricValue! memoryBandwidth: MetricValue!
topology: Topology! topology: Topology!
metricConfig: [MetricConfig!]!
} }
type MetricValue { type MetricValue {
@ -75,23 +74,24 @@ type Accelerator {
type SubClusterConfig { type SubClusterConfig {
name: String! name: String!
peak: Float! peak: Float
normal: Float! normal: Float
caution: Float! caution: Float
alert: Float! alert: Float
remove: Boolean
} }
type MetricConfig { type MetricConfig {
name: String! name: String!
unit: Unit unit: Unit!
scope: MetricScope! scope: MetricScope!
aggregation: String aggregation: String!
timestep: Int! timestep: Int!
peak: Float! peak: Float!
normal: Float! normal: Float
caution: Float! caution: Float!
alert: Float! alert: Float!
subClusters: [SubClusterConfig] subClusters: [SubClusterConfig!]!
} }
type Tag { type Tag {

View File

@ -219,7 +219,6 @@ type ComplexityRoot struct {
FlopRateScalar func(childComplexity int) int FlopRateScalar func(childComplexity int) int
FlopRateSimd func(childComplexity int) int FlopRateSimd func(childComplexity int) int
MemoryBandwidth func(childComplexity int) int MemoryBandwidth func(childComplexity int) int
MetricConfig func(childComplexity int) int
Name func(childComplexity int) int Name func(childComplexity int) int
Nodes func(childComplexity int) int Nodes func(childComplexity int) int
NumberOfNodes func(childComplexity int) int NumberOfNodes func(childComplexity int) int
@ -235,6 +234,7 @@ type ComplexityRoot struct {
Name func(childComplexity int) int Name func(childComplexity int) int
Normal func(childComplexity int) int Normal func(childComplexity int) int
Peak func(childComplexity int) int Peak func(childComplexity int) int
Remove func(childComplexity int) int
} }
Tag struct { Tag struct {
@ -1139,13 +1139,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.SubCluster.MemoryBandwidth(childComplexity), true return e.complexity.SubCluster.MemoryBandwidth(childComplexity), true
case "SubCluster.metricConfig":
if e.complexity.SubCluster.MetricConfig == nil {
break
}
return e.complexity.SubCluster.MetricConfig(childComplexity), true
case "SubCluster.name": case "SubCluster.name":
if e.complexity.SubCluster.Name == nil { if e.complexity.SubCluster.Name == nil {
break break
@ -1230,6 +1223,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.SubClusterConfig.Peak(childComplexity), true return e.complexity.SubClusterConfig.Peak(childComplexity), true
case "SubClusterConfig.remove":
if e.complexity.SubClusterConfig.Remove == nil {
break
}
return e.complexity.SubClusterConfig.Remove(childComplexity), true
case "Tag.id": case "Tag.id":
if e.complexity.Tag.ID == nil { if e.complexity.Tag.ID == nil {
break break
@ -1469,7 +1469,6 @@ type SubCluster {
flopRateSimd: MetricValue! flopRateSimd: MetricValue!
memoryBandwidth: MetricValue! memoryBandwidth: MetricValue!
topology: Topology! topology: Topology!
metricConfig: [MetricConfig!]!
} }
type MetricValue { type MetricValue {
@ -1494,23 +1493,24 @@ type Accelerator {
type SubClusterConfig { type SubClusterConfig {
name: String! name: String!
peak: Float! peak: Float
normal: Float! normal: Float
caution: Float! caution: Float
alert: Float! alert: Float
remove: Boolean
} }
type MetricConfig { type MetricConfig {
name: String! name: String!
unit: Unit unit: Unit!
scope: MetricScope! scope: MetricScope!
aggregation: String aggregation: String!
timestep: Int! timestep: Int!
peak: Float! peak: Float!
normal: Float! normal: Float
caution: Float! caution: Float!
alert: Float! alert: Float!
subClusters: [SubClusterConfig] subClusters: [SubClusterConfig!]!
} }
type Tag { type Tag {
@ -2545,8 +2545,6 @@ func (ec *executionContext) fieldContext_Cluster_subClusters(ctx context.Context
return ec.fieldContext_SubCluster_memoryBandwidth(ctx, field) return ec.fieldContext_SubCluster_memoryBandwidth(ctx, field)
case "topology": case "topology":
return ec.fieldContext_SubCluster_topology(ctx, field) return ec.fieldContext_SubCluster_topology(ctx, field)
case "metricConfig":
return ec.fieldContext_SubCluster_metricConfig(ctx, field)
} }
return nil, fmt.Errorf("no field named %q was found under type SubCluster", field.Name) return nil, fmt.Errorf("no field named %q was found under type SubCluster", field.Name)
}, },
@ -4833,11 +4831,14 @@ func (ec *executionContext) _MetricConfig_unit(ctx context.Context, field graphq
return graphql.Null return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null return graphql.Null
} }
res := resTmp.(schema.Unit) res := resTmp.(schema.Unit)
fc.Result = res fc.Result = res
return ec.marshalOUnit2githubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐUnit(ctx, field.Selections, res) return ec.marshalNUnit2githubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐUnit(ctx, field.Selections, res)
} }
func (ec *executionContext) fieldContext_MetricConfig_unit(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_MetricConfig_unit(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@ -4924,11 +4925,14 @@ func (ec *executionContext) _MetricConfig_aggregation(ctx context.Context, field
return graphql.Null return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null return graphql.Null
} }
res := resTmp.(*string) res := resTmp.(*string)
fc.Result = res fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res) return ec.marshalNString2ᚖstring(ctx, field.Selections, res)
} }
func (ec *executionContext) fieldContext_MetricConfig_aggregation(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_MetricConfig_aggregation(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@ -5053,14 +5057,11 @@ func (ec *executionContext) _MetricConfig_normal(ctx context.Context, field grap
return graphql.Null return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null return graphql.Null
} }
res := resTmp.(*float64) res := resTmp.(*float64)
fc.Result = res fc.Result = res
return ec.marshalNFloat2ᚖfloat64(ctx, field.Selections, res) return ec.marshalOFloat2ᚖfloat64(ctx, field.Selections, res)
} }
func (ec *executionContext) fieldContext_MetricConfig_normal(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_MetricConfig_normal(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@ -5185,11 +5186,14 @@ func (ec *executionContext) _MetricConfig_subClusters(ctx context.Context, field
return graphql.Null return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null return graphql.Null
} }
res := resTmp.([]*schema.SubClusterConfig) res := resTmp.([]*schema.SubClusterConfig)
fc.Result = res fc.Result = res
return ec.marshalOSubClusterConfig2ᚕᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐSubClusterConfig(ctx, field.Selections, res) return ec.marshalNSubClusterConfig2ᚕᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐSubClusterConfig(ctx, field.Selections, res)
} }
func (ec *executionContext) fieldContext_MetricConfig_subClusters(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_MetricConfig_subClusters(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@ -5210,6 +5214,8 @@ func (ec *executionContext) fieldContext_MetricConfig_subClusters(ctx context.Co
return ec.fieldContext_SubClusterConfig_caution(ctx, field) return ec.fieldContext_SubClusterConfig_caution(ctx, field)
case "alert": case "alert":
return ec.fieldContext_SubClusterConfig_alert(ctx, field) return ec.fieldContext_SubClusterConfig_alert(ctx, field)
case "remove":
return ec.fieldContext_SubClusterConfig_remove(ctx, field)
} }
return nil, fmt.Errorf("no field named %q was found under type SubClusterConfig", field.Name) return nil, fmt.Errorf("no field named %q was found under type SubClusterConfig", field.Name)
}, },
@ -7846,72 +7852,6 @@ func (ec *executionContext) fieldContext_SubCluster_topology(ctx context.Context
return fc, nil return fc, nil
} }
func (ec *executionContext) _SubCluster_metricConfig(ctx context.Context, field graphql.CollectedField, obj *schema.SubCluster) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_SubCluster_metricConfig(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.MetricConfig, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]*schema.MetricConfig)
fc.Result = res
return ec.marshalNMetricConfig2ᚕᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐMetricConfigᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_SubCluster_metricConfig(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "SubCluster",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "name":
return ec.fieldContext_MetricConfig_name(ctx, field)
case "unit":
return ec.fieldContext_MetricConfig_unit(ctx, field)
case "scope":
return ec.fieldContext_MetricConfig_scope(ctx, field)
case "aggregation":
return ec.fieldContext_MetricConfig_aggregation(ctx, field)
case "timestep":
return ec.fieldContext_MetricConfig_timestep(ctx, field)
case "peak":
return ec.fieldContext_MetricConfig_peak(ctx, field)
case "normal":
return ec.fieldContext_MetricConfig_normal(ctx, field)
case "caution":
return ec.fieldContext_MetricConfig_caution(ctx, field)
case "alert":
return ec.fieldContext_MetricConfig_alert(ctx, field)
case "subClusters":
return ec.fieldContext_MetricConfig_subClusters(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type MetricConfig", field.Name)
},
}
return fc, nil
}
func (ec *executionContext) _SubClusterConfig_name(ctx context.Context, field graphql.CollectedField, obj *schema.SubClusterConfig) (ret graphql.Marshaler) { func (ec *executionContext) _SubClusterConfig_name(ctx context.Context, field graphql.CollectedField, obj *schema.SubClusterConfig) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_SubClusterConfig_name(ctx, field) fc, err := ec.fieldContext_SubClusterConfig_name(ctx, field)
if err != nil { if err != nil {
@ -7977,14 +7917,11 @@ func (ec *executionContext) _SubClusterConfig_peak(ctx context.Context, field gr
return graphql.Null return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null return graphql.Null
} }
res := resTmp.(float64) res := resTmp.(float64)
fc.Result = res fc.Result = res
return ec.marshalNFloat2float64(ctx, field.Selections, res) return ec.marshalOFloat2float64(ctx, field.Selections, res)
} }
func (ec *executionContext) fieldContext_SubClusterConfig_peak(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_SubClusterConfig_peak(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@ -8021,14 +7958,11 @@ func (ec *executionContext) _SubClusterConfig_normal(ctx context.Context, field
return graphql.Null return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null return graphql.Null
} }
res := resTmp.(float64) res := resTmp.(float64)
fc.Result = res fc.Result = res
return ec.marshalNFloat2float64(ctx, field.Selections, res) return ec.marshalOFloat2float64(ctx, field.Selections, res)
} }
func (ec *executionContext) fieldContext_SubClusterConfig_normal(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_SubClusterConfig_normal(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@ -8065,14 +7999,11 @@ func (ec *executionContext) _SubClusterConfig_caution(ctx context.Context, field
return graphql.Null return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null return graphql.Null
} }
res := resTmp.(float64) res := resTmp.(float64)
fc.Result = res fc.Result = res
return ec.marshalNFloat2float64(ctx, field.Selections, res) return ec.marshalOFloat2float64(ctx, field.Selections, res)
} }
func (ec *executionContext) fieldContext_SubClusterConfig_caution(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_SubClusterConfig_caution(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@ -8109,14 +8040,11 @@ func (ec *executionContext) _SubClusterConfig_alert(ctx context.Context, field g
return graphql.Null return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null return graphql.Null
} }
res := resTmp.(float64) res := resTmp.(float64)
fc.Result = res fc.Result = res
return ec.marshalNFloat2float64(ctx, field.Selections, res) return ec.marshalOFloat2float64(ctx, field.Selections, res)
} }
func (ec *executionContext) fieldContext_SubClusterConfig_alert(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_SubClusterConfig_alert(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@ -8132,6 +8060,47 @@ func (ec *executionContext) fieldContext_SubClusterConfig_alert(ctx context.Cont
return fc, nil return fc, nil
} }
func (ec *executionContext) _SubClusterConfig_remove(ctx context.Context, field graphql.CollectedField, obj *schema.SubClusterConfig) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_SubClusterConfig_remove(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Remove, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(bool)
fc.Result = res
return ec.marshalOBoolean2bool(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_SubClusterConfig_remove(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "SubClusterConfig",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type Boolean does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _Tag_id(ctx context.Context, field graphql.CollectedField, obj *schema.Tag) (ret graphql.Marshaler) { func (ec *executionContext) _Tag_id(ctx context.Context, field graphql.CollectedField, obj *schema.Tag) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Tag_id(ctx, field) fc, err := ec.fieldContext_Tag_id(ctx, field)
if err != nil { if err != nil {
@ -11669,6 +11638,9 @@ func (ec *executionContext) _MetricConfig(ctx context.Context, sel ast.Selection
out.Values[i] = ec._MetricConfig_unit(ctx, field, obj) out.Values[i] = ec._MetricConfig_unit(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
case "scope": case "scope":
out.Values[i] = ec._MetricConfig_scope(ctx, field, obj) out.Values[i] = ec._MetricConfig_scope(ctx, field, obj)
@ -11680,6 +11652,9 @@ func (ec *executionContext) _MetricConfig(ctx context.Context, sel ast.Selection
out.Values[i] = ec._MetricConfig_aggregation(ctx, field, obj) out.Values[i] = ec._MetricConfig_aggregation(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
case "timestep": case "timestep":
out.Values[i] = ec._MetricConfig_timestep(ctx, field, obj) out.Values[i] = ec._MetricConfig_timestep(ctx, field, obj)
@ -11698,9 +11673,6 @@ func (ec *executionContext) _MetricConfig(ctx context.Context, sel ast.Selection
out.Values[i] = ec._MetricConfig_normal(ctx, field, obj) out.Values[i] = ec._MetricConfig_normal(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
case "caution": case "caution":
out.Values[i] = ec._MetricConfig_caution(ctx, field, obj) out.Values[i] = ec._MetricConfig_caution(ctx, field, obj)
@ -11719,6 +11691,9 @@ func (ec *executionContext) _MetricConfig(ctx context.Context, sel ast.Selection
out.Values[i] = ec._MetricConfig_subClusters(ctx, field, obj) out.Values[i] = ec._MetricConfig_subClusters(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
default: default:
panic("unknown field " + strconv.Quote(field.Name)) panic("unknown field " + strconv.Quote(field.Name))
} }
@ -12474,13 +12449,6 @@ func (ec *executionContext) _SubCluster(ctx context.Context, sel ast.SelectionSe
out.Values[i] = ec._SubCluster_topology(ctx, field, obj) out.Values[i] = ec._SubCluster_topology(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
case "metricConfig":
out.Values[i] = ec._SubCluster_metricConfig(ctx, field, obj)
if out.Values[i] == graphql.Null { if out.Values[i] == graphql.Null {
invalids++ invalids++
} }
@ -12516,30 +12484,22 @@ func (ec *executionContext) _SubClusterConfig(ctx context.Context, sel ast.Selec
out.Values[i] = ec._SubClusterConfig_peak(ctx, field, obj) out.Values[i] = ec._SubClusterConfig_peak(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
case "normal": case "normal":
out.Values[i] = ec._SubClusterConfig_normal(ctx, field, obj) out.Values[i] = ec._SubClusterConfig_normal(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
case "caution": case "caution":
out.Values[i] = ec._SubClusterConfig_caution(ctx, field, obj) out.Values[i] = ec._SubClusterConfig_caution(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
case "alert": case "alert":
out.Values[i] = ec._SubClusterConfig_alert(ctx, field, obj) out.Values[i] = ec._SubClusterConfig_alert(ctx, field, obj)
if out.Values[i] == graphql.Null { case "remove":
invalids++
} out.Values[i] = ec._SubClusterConfig_remove(ctx, field, obj)
default: default:
panic("unknown field " + strconv.Quote(field.Name)) panic("unknown field " + strconv.Quote(field.Name))
} }
@ -14075,6 +14035,27 @@ func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel
return ret return ret
} }
func (ec *executionContext) unmarshalNString2ᚖstring(ctx context.Context, v interface{}) (*string, error) {
res, err := graphql.UnmarshalString(v)
return &res, graphql.ErrorOnPath(ctx, err)
}
func (ec *executionContext) marshalNString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
}
return graphql.Null
}
res := graphql.MarshalString(*v)
if res == graphql.Null {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
}
}
return res
}
func (ec *executionContext) marshalNSubCluster2ᚕᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐSubClusterᚄ(ctx context.Context, sel ast.SelectionSet, v []*schema.SubCluster) graphql.Marshaler { func (ec *executionContext) marshalNSubCluster2ᚕᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐSubClusterᚄ(ctx context.Context, sel ast.SelectionSet, v []*schema.SubCluster) graphql.Marshaler {
ret := make(graphql.Array, len(v)) ret := make(graphql.Array, len(v))
var wg sync.WaitGroup var wg sync.WaitGroup
@ -14129,6 +14110,60 @@ func (ec *executionContext) marshalNSubCluster2ᚖgithubᚗcomᚋClusterCockpit
return ec._SubCluster(ctx, sel, v) return ec._SubCluster(ctx, sel, v)
} }
func (ec *executionContext) marshalNSubClusterConfig2ᚕᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐSubClusterConfigᚄ(ctx context.Context, sel ast.SelectionSet, v []*schema.SubClusterConfig) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
if !isLen1 {
wg.Add(len(v))
}
for i := range v {
i := i
fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = nil
}
}()
if !isLen1 {
defer wg.Done()
}
ret[i] = ec.marshalNSubClusterConfig2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐSubClusterConfig(ctx, sel, v[i])
}
if isLen1 {
f(i)
} else {
go f(i)
}
}
wg.Wait()
for _, e := range ret {
if e == graphql.Null {
return graphql.Null
}
}
return ret
}
func (ec *executionContext) marshalNSubClusterConfig2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐSubClusterConfig(ctx context.Context, sel ast.SelectionSet, v *schema.SubClusterConfig) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
}
return graphql.Null
}
return ec._SubClusterConfig(ctx, sel, v)
}
func (ec *executionContext) marshalNTag2githubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐTag(ctx context.Context, sel ast.SelectionSet, v schema.Tag) graphql.Marshaler { func (ec *executionContext) marshalNTag2githubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐTag(ctx context.Context, sel ast.SelectionSet, v schema.Tag) graphql.Marshaler {
return ec._Tag(ctx, sel, &v) return ec._Tag(ctx, sel, &v)
} }
@ -14574,6 +14609,32 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast
return res return res
} }
func (ec *executionContext) unmarshalOFloat2float64(ctx context.Context, v interface{}) (float64, error) {
res, err := graphql.UnmarshalFloatContext(ctx, v)
return res, graphql.ErrorOnPath(ctx, err)
}
func (ec *executionContext) marshalOFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler {
res := graphql.MarshalFloatContext(v)
return graphql.WrapContextMarshaler(ctx, res)
}
func (ec *executionContext) unmarshalOFloat2ᚖfloat64(ctx context.Context, v interface{}) (*float64, error) {
if v == nil {
return nil, nil
}
res, err := graphql.UnmarshalFloatContext(ctx, v)
return &res, graphql.ErrorOnPath(ctx, err)
}
func (ec *executionContext) marshalOFloat2ᚖfloat64(ctx context.Context, sel ast.SelectionSet, v *float64) graphql.Marshaler {
if v == nil {
return graphql.Null
}
res := graphql.MarshalFloatContext(*v)
return graphql.WrapContextMarshaler(ctx, res)
}
func (ec *executionContext) unmarshalOFloatRange2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋinternalᚋgraphᚋmodelᚐFloatRange(ctx context.Context, v interface{}) (*model.FloatRange, error) { func (ec *executionContext) unmarshalOFloatRange2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋinternalᚋgraphᚋmodelᚐFloatRange(ctx context.Context, v interface{}) (*model.FloatRange, error) {
if v == nil { if v == nil {
return nil, nil return nil, nil
@ -14987,54 +15048,6 @@ func (ec *executionContext) unmarshalOStringInput2ᚖgithubᚗcomᚋClusterCockp
return &res, graphql.ErrorOnPath(ctx, err) return &res, graphql.ErrorOnPath(ctx, err)
} }
func (ec *executionContext) marshalOSubClusterConfig2ᚕᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐSubClusterConfig(ctx context.Context, sel ast.SelectionSet, v []*schema.SubClusterConfig) graphql.Marshaler {
if v == nil {
return graphql.Null
}
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
if !isLen1 {
wg.Add(len(v))
}
for i := range v {
i := i
fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = nil
}
}()
if !isLen1 {
defer wg.Done()
}
ret[i] = ec.marshalOSubClusterConfig2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐSubClusterConfig(ctx, sel, v[i])
}
if isLen1 {
f(i)
} else {
go f(i)
}
}
wg.Wait()
return ret
}
func (ec *executionContext) marshalOSubClusterConfig2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐSubClusterConfig(ctx context.Context, sel ast.SelectionSet, v *schema.SubClusterConfig) graphql.Marshaler {
if v == nil {
return graphql.Null
}
return ec._SubClusterConfig(ctx, sel, v)
}
func (ec *executionContext) unmarshalOTime2ᚖtimeᚐTime(ctx context.Context, v interface{}) (*time.Time, error) { func (ec *executionContext) unmarshalOTime2ᚖtimeᚐTime(ctx context.Context, v interface{}) (*time.Time, error) {
if v == nil { if v == nil {
return nil, nil return nil, nil

View File

@ -38,7 +38,6 @@ type SubCluster struct {
FlopRateSimd *MetricValue `json:"flopRateSimd"` FlopRateSimd *MetricValue `json:"flopRateSimd"`
MemoryBandwidth *MetricValue `json:"memoryBandwidth"` MemoryBandwidth *MetricValue `json:"memoryBandwidth"`
Topology *Topology `json:"topology"` Topology *Topology `json:"topology"`
MetricConfig []*MetricConfig `json:"metricConfig"`
} }
type SubClusterConfig struct { type SubClusterConfig struct {
@ -47,6 +46,7 @@ type SubClusterConfig struct {
Normal float64 `json:"normal"` Normal float64 `json:"normal"`
Caution float64 `json:"caution"` Caution float64 `json:"caution"`
Alert float64 `json:"alert"` Alert float64 `json:"alert"`
Remove bool `json:"remove"`
} }
type MetricConfig struct { type MetricConfig struct {

View File

@ -76,13 +76,13 @@
}, },
"alert": { "alert": {
"type": "number" "type": "number"
},
"remove": {
"type": "boolean"
} }
}, },
"required": [ "required": [
"name", "name"
"peak",
"caution",
"alert"
] ]
} }
} }
@ -261,6 +261,7 @@
}, },
"required": [ "required": [
"name", "name",
"nodes",
"topology", "topology",
"processorType", "processorType",
"socketsPerNode", "socketsPerNode",

File diff suppressed because it is too large Load Diff

View File

@ -22,8 +22,7 @@ func loadJobData(filename string) (*JobData, error) {
f, err := os.Open(filename) f, err := os.Open(filename)
if err != nil { if err != nil {
fmt.Errorf("fsBackend loadJobData()- %v", err) return &JobData{}, fmt.Errorf("fsBackend loadJobData()- %v", err)
return &JobData{}, err
} }
defer f.Close() defer f.Close()
@ -175,10 +174,10 @@ func main() {
} }
jmn := deepCopyJobMeta(job) jmn := deepCopyJobMeta(job)
if err := EncodeJobMeta(f, &jmn); err != nil { if err = EncodeJobMeta(f, &jmn); err != nil {
log.Fatal(err) log.Fatal(err)
} }
if err := f.Close(); err != nil { if err = f.Close(); err != nil {
log.Fatal(err) log.Fatal(err)
} }
@ -188,7 +187,11 @@ func main() {
} }
sroot := fmt.Sprintf("%s/%s/", srcPath, job.Cluster) sroot := fmt.Sprintf("%s/%s/", srcPath, job.Cluster)
jd, err := loadJobData(getPath(job, sroot, "data.json")) var jd *JobData
jd, err = loadJobData(getPath(job, sroot, "data.json"))
if err != nil {
log.Fatal(err)
}
jdn := deepCopyJobData(jd) jdn := deepCopyJobData(jd)
if err := EncodeJobData(f, &jdn); err != nil { if err := EncodeJobData(f, &jdn); err != nil {
log.Fatal(err) log.Fatal(err)