diff --git a/api/schema.graphqls b/api/schema.graphqls index fb7d225..26c1c0b 100644 --- a/api/schema.graphqls +++ b/api/schema.graphqls @@ -50,7 +50,6 @@ type SubCluster { flopRateSimd: MetricValue! memoryBandwidth: MetricValue! topology: Topology! - metricConfig: [MetricConfig!]! } type MetricValue { @@ -75,23 +74,24 @@ type Accelerator { type SubClusterConfig { name: String! - peak: Float! - normal: Float! - caution: Float! - alert: Float! + peak: Float + normal: Float + caution: Float + alert: Float + remove: Boolean } type MetricConfig { name: String! - unit: Unit + unit: Unit! scope: MetricScope! - aggregation: String + aggregation: String! timestep: Int! peak: Float! - normal: Float! + normal: Float caution: Float! alert: Float! - subClusters: [SubClusterConfig] + subClusters: [SubClusterConfig!]! } type Tag { diff --git a/internal/graph/generated/generated.go b/internal/graph/generated/generated.go index d9833b4..9c81fad 100644 --- a/internal/graph/generated/generated.go +++ b/internal/graph/generated/generated.go @@ -219,7 +219,6 @@ type ComplexityRoot struct { FlopRateScalar func(childComplexity int) int FlopRateSimd func(childComplexity int) int MemoryBandwidth func(childComplexity int) int - MetricConfig func(childComplexity int) int Name func(childComplexity int) int Nodes func(childComplexity int) int NumberOfNodes func(childComplexity int) int @@ -235,6 +234,7 @@ type ComplexityRoot struct { Name func(childComplexity int) int Normal func(childComplexity int) int Peak func(childComplexity int) int + Remove func(childComplexity int) int } Tag struct { @@ -1139,13 +1139,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in 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": if e.complexity.SubCluster.Name == nil { break @@ -1230,6 +1223,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in 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": if e.complexity.Tag.ID == nil { break @@ -1469,7 +1469,6 @@ type SubCluster { flopRateSimd: MetricValue! memoryBandwidth: MetricValue! topology: Topology! - metricConfig: [MetricConfig!]! } type MetricValue { @@ -1494,23 +1493,24 @@ type Accelerator { type SubClusterConfig { name: String! - peak: Float! - normal: Float! - caution: Float! - alert: Float! + peak: Float + normal: Float + caution: Float + alert: Float + remove: Boolean } type MetricConfig { name: String! - unit: Unit + unit: Unit! scope: MetricScope! - aggregation: String + aggregation: String! timestep: Int! peak: Float! - normal: Float! + normal: Float caution: Float! alert: Float! - subClusters: [SubClusterConfig] + subClusters: [SubClusterConfig!]! } type Tag { @@ -2545,8 +2545,6 @@ func (ec *executionContext) fieldContext_Cluster_subClusters(ctx context.Context return ec.fieldContext_SubCluster_memoryBandwidth(ctx, field) case "topology": 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) }, @@ -4833,11 +4831,14 @@ func (ec *executionContext) _MetricConfig_unit(ctx context.Context, field graphq return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } res := resTmp.(schema.Unit) 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) { @@ -4924,11 +4925,14 @@ func (ec *executionContext) _MetricConfig_aggregation(ctx context.Context, field return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } res := resTmp.(*string) 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) { @@ -5053,14 +5057,11 @@ func (ec *executionContext) _MetricConfig_normal(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } res := resTmp.(*float64) 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) { @@ -5185,11 +5186,14 @@ func (ec *executionContext) _MetricConfig_subClusters(ctx context.Context, field return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } res := resTmp.([]*schema.SubClusterConfig) 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) { @@ -5210,6 +5214,8 @@ func (ec *executionContext) fieldContext_MetricConfig_subClusters(ctx context.Co return ec.fieldContext_SubClusterConfig_caution(ctx, field) case "alert": 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) }, @@ -7846,72 +7852,6 @@ func (ec *executionContext) fieldContext_SubCluster_topology(ctx context.Context 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) { fc, err := ec.fieldContext_SubClusterConfig_name(ctx, field) if err != nil { @@ -7977,14 +7917,11 @@ func (ec *executionContext) _SubClusterConfig_peak(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } res := resTmp.(float64) 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) { @@ -8021,14 +7958,11 @@ func (ec *executionContext) _SubClusterConfig_normal(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } res := resTmp.(float64) 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) { @@ -8065,14 +7999,11 @@ func (ec *executionContext) _SubClusterConfig_caution(ctx context.Context, field return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } res := resTmp.(float64) 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) { @@ -8109,14 +8040,11 @@ func (ec *executionContext) _SubClusterConfig_alert(ctx context.Context, field g return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } res := resTmp.(float64) 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) { @@ -8132,6 +8060,47 @@ func (ec *executionContext) fieldContext_SubClusterConfig_alert(ctx context.Cont 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) { fc, err := ec.fieldContext_Tag_id(ctx, field) 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) + if out.Values[i] == graphql.Null { + invalids++ + } case "scope": 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) + if out.Values[i] == graphql.Null { + invalids++ + } case "timestep": 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) - if out.Values[i] == graphql.Null { - invalids++ - } case "caution": 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) + if out.Values[i] == graphql.Null { + invalids++ + } default: 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) - if out.Values[i] == graphql.Null { - invalids++ - } - case "metricConfig": - - out.Values[i] = ec._SubCluster_metricConfig(ctx, field, obj) - if out.Values[i] == graphql.Null { invalids++ } @@ -12516,30 +12484,22 @@ func (ec *executionContext) _SubClusterConfig(ctx context.Context, sel ast.Selec out.Values[i] = ec._SubClusterConfig_peak(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } case "normal": out.Values[i] = ec._SubClusterConfig_normal(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } case "caution": out.Values[i] = ec._SubClusterConfig_caution(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } case "alert": out.Values[i] = ec._SubClusterConfig_alert(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } + case "remove": + + out.Values[i] = ec._SubClusterConfig_remove(ctx, field, obj) + default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -14075,6 +14035,27 @@ func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel 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 { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup @@ -14129,6 +14110,60 @@ func (ec *executionContext) marshalNSubCluster2ᚖgithubᚗcomᚋClusterCockpit 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 { return ec._Tag(ctx, sel, &v) } @@ -14574,6 +14609,32 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast 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) { if v == nil { return nil, nil @@ -14987,54 +15048,6 @@ func (ec *executionContext) unmarshalOStringInput2ᚖgithubᚗcomᚋClusterCockp 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) { if v == nil { return nil, nil diff --git a/pkg/schema/cluster.go b/pkg/schema/cluster.go index 3805427..5b7603f 100644 --- a/pkg/schema/cluster.go +++ b/pkg/schema/cluster.go @@ -27,18 +27,17 @@ type MetricValue struct { } type SubCluster struct { - Name string `json:"name"` - Nodes string `json:"nodes"` - NumberOfNodes int `json:"numberOfNodes"` - ProcessorType string `json:"processorType"` - SocketsPerNode int `json:"socketsPerNode"` - CoresPerSocket int `json:"coresPerSocket"` - ThreadsPerCore int `json:"threadsPerCore"` - FlopRateScalar *MetricValue `json:"flopRateScalar"` - FlopRateSimd *MetricValue `json:"flopRateSimd"` - MemoryBandwidth *MetricValue `json:"memoryBandwidth"` - Topology *Topology `json:"topology"` - MetricConfig []*MetricConfig `json:"metricConfig"` + Name string `json:"name"` + Nodes string `json:"nodes"` + NumberOfNodes int `json:"numberOfNodes"` + ProcessorType string `json:"processorType"` + SocketsPerNode int `json:"socketsPerNode"` + CoresPerSocket int `json:"coresPerSocket"` + ThreadsPerCore int `json:"threadsPerCore"` + FlopRateScalar *MetricValue `json:"flopRateScalar"` + FlopRateSimd *MetricValue `json:"flopRateSimd"` + MemoryBandwidth *MetricValue `json:"memoryBandwidth"` + Topology *Topology `json:"topology"` } type SubClusterConfig struct { @@ -47,6 +46,7 @@ type SubClusterConfig struct { Normal float64 `json:"normal"` Caution float64 `json:"caution"` Alert float64 `json:"alert"` + Remove bool `json:"remove"` } type MetricConfig struct { diff --git a/pkg/schema/schemas/cluster.schema.json b/pkg/schema/schemas/cluster.schema.json index afedf33..bd14b49 100644 --- a/pkg/schema/schemas/cluster.schema.json +++ b/pkg/schema/schemas/cluster.schema.json @@ -76,13 +76,13 @@ }, "alert": { "type": "number" + }, + "remove": { + "type": "boolean" } }, "required": [ - "name", - "peak", - "caution", - "alert" + "name" ] } } @@ -261,6 +261,7 @@ }, "required": [ "name", + "nodes", "topology", "processorType", "socketsPerNode", diff --git a/test/archive/emmy/cluster.json b/test/archive/emmy/cluster.json index 2df9601..c965f3e 100644 --- a/test/archive/emmy/cluster.json +++ b/test/archive/emmy/cluster.json @@ -2,26 +2,690 @@ "name": "emmy", "subClusters": [ { - "name": "main", - "processorType": "Intel IvyBridge", - "socketsPerNode": 2, - "coresPerSocket": 10, - "threadsPerCore": 2, - "flopRateScalar": 44, - "flopRateSimd": 704, - "memoryBandwidth": 80, + "name": "haswell", + "processorType": "Intel Xeon E3-1240 v3", + "socketsPerNode": 1, + "coresPerSocket": 4, + "threadsPerCore": 1, + "flopRateScalar": { + "unit": { + "prefix": "G", + "base": "F/s" + }, + "value": 14 + }, + "flopRateSimd": { + "unit": { + "prefix": "G", + "base": "F/s" + }, + "value": 112 + }, + "memoryBandwidth": { + "unit": { + "prefix": "G", + "base": "B/s" + }, + "value": 24 + }, + "numberOfNodes": 70, + "nodes": "w11[27-45,49-63,69-72]", "topology": { - "node": [0,20,1,21,2,22,3,23,4,24,5,25,6,26,7,27,8,28,9,29,10,30,11,31,12,32,13,33,14,34,15,35,16,36,17,37,18,38,19,39], + "node": [ + 0, + 1, + 2, + 3 + ], "socket": [ - [0,20,1,21,2,22,3,23,4,24,5,25,6,26,7,27,8,28,9,29], - [10,30,11,31,12,32,13,33,14,34,15,35,16,36,17,37,18,38,19,39] + [ + 0, + 1, + 2, + 3 + ] ], "memoryDomain": [ - [0,20,1,21,2,22,3,23,4,24,5,25,6,26,7,27,8,28,9,29], - [10,30,11,31,12,32,13,33,14,34,15,35,16,36,17,37,18,38,19,39] + [ + 0, + 1, + 2, + 3 + ] ], "core": [ - [0,20],[1,21],[2,22],[3,23],[4,24],[5,25],[6,26],[7,27],[8,28],[9,29],[10,30],[11,31],[12,32],[13,33],[14,34],[15,35],[16,36],[17,37],[18,38],[19,39] + [ + 0 + ], + [ + 1 + ], + [ + 2 + ], + [ + 3 + ] + ] + } + }, + { + "name": "skylake", + "processorType": "Intel Xeon E3-1240 v5 ", + "socketsPerNode": 1, + "coresPerSocket": 4, + "threadsPerCore": 1, + "flopRateScalar": { + "unit": { + "prefix": "G", + "base": "F/s" + }, + "value": 14 + }, + "flopRateSimd": { + "unit": { + "prefix": "G", + "base": "F/s" + }, + "value": 112 + }, + "memoryBandwidth": { + "unit": { + "prefix": "G", + "base": "B/s" + }, + "value": 64 + }, + "numberOfNodes": 64, + "nodes": "w12[01-08],w13[01-31,33-56]", + "topology": { + "node": [ + 0, + 1, + 2, + 3 + ], + "socket": [ + [ + 0, + 1, + 2, + 3 + ] + ], + "memoryDomain": [ + [ + 0, + 1, + 2, + 3 + ] + ], + "core": [ + [ + 0 + ], + [ + 1 + ], + [ + 2 + ], + [ + 3 + ] + ] + } + }, + { + "name": "kabylake", + "processorType": "Intel Xeon E3-1240 v6", + "socketsPerNode": 1, + "coresPerSocket": 4, + "threadsPerCore": 1, + "flopRateScalar": { + "unit": { + "prefix": "G", + "base": "F/s" + }, + "value": 14 + }, + "flopRateSimd": { + "unit": { + "prefix": "G", + "base": "F/s" + }, + "value": 112 + }, + "memoryBandwidth": { + "unit": { + "prefix": "G", + "base": "B/s" + }, + "value": 24 + }, + "numberOfNodes": 112, + "nodes": "w14[01-56],w15[01-05,07-56]", + "topology": { + "node": [ + 0, + 1, + 2, + 3 + ], + "socket": [ + [ + 0, + 1, + 2, + 3 + ] + ], + "memoryDomain": [ + [ + 0, + 1, + 2, + 3 + ] + ], + "core": [ + [ + 0 + ], + [ + 1 + ], + [ + 2 + ], + [ + 3 + ] + ] + } + }, + { + "name": "icelake", + "processorType": "Intel Xeon Gold 6326", + "socketsPerNode": 2, + "coresPerSocket": 16, + "threadsPerCore": 1, + "flopRateScalar": { + "unit": { + "prefix": "G", + "base": "F/s" + }, + "value": 432 + }, + "flopRateSimd": { + "unit": { + "prefix": "G", + "base": "F/s" + }, + "value": 9216 + }, + "memoryBandwidth": { + "unit": { + "prefix": "G", + "base": "B/s" + }, + "value": 350 + }, + "numberOfNodes": 70, + "nodes": "w22[01-35],w23[01-35]", + "topology": { + "node": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71 + ], + "socket": [ + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35 + ], + [ + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71 + ] + ], + "memoryDomain": [ + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17 + ], + [ + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35 + ], + [ + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53 + ], + [ + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71 + ] + ], + "core": [ + [ + 0 + ], + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ], + [ + 5 + ], + [ + 6 + ], + [ + 7 + ], + [ + 8 + ], + [ + 9 + ], + [ + 10 + ], + [ + 11 + ], + [ + 12 + ], + [ + 13 + ], + [ + 14 + ], + [ + 15 + ], + [ + 16 + ], + [ + 17 + ], + [ + 18 + ], + [ + 19 + ], + [ + 20 + ], + [ + 21 + ], + [ + 22 + ], + [ + 23 + ], + [ + 24 + ], + [ + 25 + ], + [ + 26 + ], + [ + 27 + ], + [ + 28 + ], + [ + 29 + ], + [ + 30 + ], + [ + 31 + ], + [ + 32 + ], + [ + 33 + ], + [ + 34 + ], + [ + 35 + ], + [ + 36 + ], + [ + 37 + ], + [ + 38 + ], + [ + 39 + ], + [ + 40 + ], + [ + 41 + ], + [ + 42 + ], + [ + 43 + ], + [ + 44 + ], + [ + 45 + ], + [ + 46 + ], + [ + 47 + ], + [ + 48 + ], + [ + 49 + ], + [ + 50 + ], + [ + 51 + ], + [ + 52 + ], + [ + 53 + ], + [ + 54 + ], + [ + 55 + ], + [ + 56 + ], + [ + 57 + ], + [ + 58 + ], + [ + 59 + ], + [ + 60 + ], + [ + 61 + ], + [ + 62 + ], + [ + 63 + ], + [ + 64 + ], + [ + 65 + ], + [ + 66 + ], + [ + 67 + ], + [ + 68 + ], + [ + 69 + ], + [ + 70 + ], + [ + 71 + ] ] } } @@ -29,143 +693,286 @@ "metricConfig": [ { "name": "cpu_load", - "scope": "hwthread", - "unit": { + "scope": "node", + "unit": { "base": "load" }, + "aggregation": "avg", "timestep": 60, - "peak": 40, - "normal": 20, - "caution": 15, - "alert": 10 + "peak": 4, + "normal": 4, + "caution": 4, + "alert": 1, + "subClusters": [ + { + "name": "icelake", + "peak": 32, + "normal": 32, + "caution": 16, + "alert": 1 + } + ] }, { - "name": "mem_used", - "scope": "node", - "unit": { - "base": "B", - "prefix": "G" - }, - "timestep": 60, - "peak": 64, - "normal": 20, - "caution": 40, - "alert": 55 - }, - { - "name": "flops_any", + "name": "cpu_user", "scope": "hwthread", - "unit": { - "base": "F/s", - "prefix": "G" + "unit": { + "base": "" }, + "aggregation": "avg", "timestep": 60, - "peak": 704, - "normal": 100, - "caution": 20, - "alert": 2 - }, - { - "name": "flops_sp", - "scope": "hwthread", - "unit": { - "base": "F/s", - "prefix": "G" - }, - "timestep": 60, - "peak": 704, - "normal": 100, - "caution": 20, - "alert": 2 - }, - { - "name": "flops_dp", - "scope": "hwthread", - "unit": { - "base": "F/s", - "prefix": "G" - }, - "timestep": 60, - "peak": 350, + "peak": 100, "normal": 50, - "caution": 10, - "alert": 2 - }, - { - "name": "mem_bw", - "scope": "memoryDomain", - "unit": { - "base": "B/s", - "prefix": "G" - }, - "timestep": 60, - "peak": 80, - "normal": 30, - "caution": 10, - "alert": 5 + "caution": 20, + "alert": 10, + "subClusters": [ + { + "name": "haswell", + "remove": true + }, + { + "name": "skylake", + "remove": true + } + ] }, { "name": "ipc", "scope": "hwthread", - "unit": { + "unit": { "base": "IPC" }, + "aggregation": "avg", "timestep": 60, - "peak": 80, + "peak": 4, + "normal": 2, + "caution": 1, + "alert": 0.25 + }, + { + "name": "mem_used", + "scope": "node", + "unit": { + "prefix": "G", + "base": "B" + }, + "aggregation": "sum", + "timestep": 60, + "peak": 32, + "normal": 16, + "caution": 28, + "alert": 30, + "subClusters": [ + { + "name": "icelake", + "peak": 256, + "normal": 128, + "caution": 245, + "alert": 255 + } + ] + }, + { + "name": "flops_any", + "scope": "hwthread", + "unit": { + "prefix": "G", + "base": "F/s" + }, + "aggregation": "sum", + "timestep": 60, + "peak": 112, + "normal": 50, + "caution": 20, + "alert": 10, + "subClusters": [ + { + "name": "icelake", + "peak": 9216, + "normal": 432, + "caution": 100, + "alert": 50 + } + ] + }, + { + "name": "flops_dp", + "scope": "hwthread", + "unit": { + "prefix": "G", + "base": "F/s" + }, + "aggregation": "sum", + "timestep": 60, + "peak": 56, "normal": 30, - "caution": 10, - "alert": 5 + "caution": 15, + "alert": 5, + "subClusters": [ + { + "name": "icelake", + "peak": 4108, + "normal": 220, + "caution": 60, + "alert": 30 + } + ] + }, + { + "name": "flops_sp", + "scope": "hwthread", + "unit": { + "prefix": "G", + "base": "F/s" + }, + "aggregation": "sum", + "timestep": 60, + "peak": 112, + "normal": 50, + "caution": 20, + "alert": 10, + "subClusters": [ + { + "name": "icelake", + "peak": 9216, + "normal": 432, + "caution": 100, + "alert": 50 + } + ] + }, + { + "name": "mem_bw", + "scope": "socket", + "unit": { + "prefix": "G", + "base": "B/s" + }, + "aggregation": "sum", + "timestep": 60, + "peak": 24, + "normal": 10, + "caution": 5, + "alert": 2, + "subClusters": [ + { + "name": "icelake", + "peak": 350, + "normal": 100, + "caution": 50, + "alert": 25 + } + ] }, { "name": "clock", "scope": "hwthread", - "unit": { - "base": "Hz", - "prefix": "M" + "unit": { + "prefix": "M", + "base": "Hz" }, + "aggregation": "avg", "timestep": 60, - "peak": 80, - "normal": 30, - "caution": 10, - "alert": 5 + "peak": 2900, + "normal": 2900, + "caution": 1500, + "alert": 1200, + "subClusters": [ + { + "name": "haswell", + "peak": 3500, + "normal": 3500, + "caution": 1500, + "alert": 1200 + }, + { + "name": "skylake", + "peak": 3500, + "normal": 3500, + "caution": 1500, + "alert": 1200 + }, + { + "name": "kabylake", + "peak": 3700, + "normal": 3700, + "caution": 1500, + "alert": 1200 + } + ] }, { - "name": "rapl_power", - "scope": "socket", - "unit": { - "base": "W" + "name": "vectorization_ratio", + "scope": "hwthread", + "unit": { + "base": "" }, + "aggregation": "avg", "timestep": 60, - "peak": 80, - "normal": 30, - "caution": 10, - "alert": 5 - }, - { - "name": "ib_bw", - "scope": "node", - "unit": { - "base": "B/s", - "prefix": "G" - }, - "timestep": 60, - "peak": 40, - "normal": 20, - "caution": 15, + "peak": 100, + "normal": 60, + "caution": 40, "alert": 10 }, { - "name": "lustre_bw", + "name": "nfs4_read", "scope": "node", - "unit": { - "base": "B/s", - "prefix": "G" + "unit": { + "prefix": "M", + "base": "B/s" }, + "aggregation": "sum", "timestep": 60, - "peak": 40, - "normal": 20, - "caution": 15, - "alert": 10 + "peak": 6, + "normal": 4, + "caution": 2, + "alert": 1, + "subClusters": [ + { + "name": "haswell", + "remove": true + } + ] + }, + { + "name": "nfs4_write", + "scope": "node", + "unit": { + "prefix": "M", + "base": "B/s" + }, + "aggregation": "sum", + "timestep": 60, + "peak": 6, + "normal": 4, + "caution": 2, + "alert": 1, + "subClusters": [ + { + "name": "haswell", + "remove": true + } + ] + }, + { + "name": "nfs4_total", + "scope": "node", + "unit": { + "prefix": "M", + "base": "B/s" + }, + "aggregation": "sum", + "timestep": 60, + "peak": 6, + "normal": 4, + "caution": 2, + "alert": 1, + "subClusters": [ + { + "name": "haswell", + "remove": true + } + ] } ] } diff --git a/tools/sanitize-archive/main.go b/tools/sanitize-archive/main.go index 7ad7c59..3f247a2 100644 --- a/tools/sanitize-archive/main.go +++ b/tools/sanitize-archive/main.go @@ -22,8 +22,7 @@ func loadJobData(filename string) (*JobData, error) { f, err := os.Open(filename) if err != nil { - fmt.Errorf("fsBackend loadJobData()- %v", err) - return &JobData{}, err + return &JobData{}, fmt.Errorf("fsBackend loadJobData()- %v", err) } defer f.Close() @@ -175,10 +174,10 @@ func main() { } jmn := deepCopyJobMeta(job) - if err := EncodeJobMeta(f, &jmn); err != nil { + if err = EncodeJobMeta(f, &jmn); err != nil { log.Fatal(err) } - if err := f.Close(); err != nil { + if err = f.Close(); err != nil { log.Fatal(err) } @@ -188,7 +187,11 @@ func main() { } 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) if err := EncodeJobData(f, &jdn); err != nil { log.Fatal(err)