mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-10 08:57:25 +01:00
initial branch commit
This commit is contained in:
parent
3e73df76dd
commit
f7571211fd
@ -156,7 +156,7 @@ type MetricFootprints {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Footprints {
|
type Footprints {
|
||||||
nodehours: [NullableFloat!]!
|
timeweights: [NullableFloat!]!
|
||||||
metrics: [MetricFootprints!]!
|
metrics: [MetricFootprints!]!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,8 +68,8 @@ type ComplexityRoot struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Footprints struct {
|
Footprints struct {
|
||||||
Metrics func(childComplexity int) int
|
Metrics func(childComplexity int) int
|
||||||
Nodehours func(childComplexity int) int
|
Timeweights func(childComplexity int) int
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoPoint struct {
|
HistoPoint struct {
|
||||||
@ -406,12 +406,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
|
|
||||||
return e.complexity.Footprints.Metrics(childComplexity), true
|
return e.complexity.Footprints.Metrics(childComplexity), true
|
||||||
|
|
||||||
case "Footprints.nodehours":
|
case "Footprints.timeweights":
|
||||||
if e.complexity.Footprints.Nodehours == nil {
|
if e.complexity.Footprints.Timeweights == nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Footprints.Nodehours(childComplexity), true
|
return e.complexity.Footprints.Timeweights(childComplexity), true
|
||||||
|
|
||||||
case "HistoPoint.count":
|
case "HistoPoint.count":
|
||||||
if e.complexity.HistoPoint.Count == nil {
|
if e.complexity.HistoPoint.Count == nil {
|
||||||
@ -1666,7 +1666,7 @@ type MetricFootprints {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Footprints {
|
type Footprints {
|
||||||
nodehours: [NullableFloat!]!
|
timeweights: [NullableFloat!]!
|
||||||
metrics: [MetricFootprints!]!
|
metrics: [MetricFootprints!]!
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2753,8 +2753,8 @@ func (ec *executionContext) fieldContext_Count_count(ctx context.Context, field
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Footprints_nodehours(ctx context.Context, field graphql.CollectedField, obj *model.Footprints) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Footprints_timeweights(ctx context.Context, field graphql.CollectedField, obj *model.Footprints) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Footprints_nodehours(ctx, field)
|
fc, err := ec.fieldContext_Footprints_timeweights(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return graphql.Null
|
return graphql.Null
|
||||||
}
|
}
|
||||||
@ -2767,7 +2767,7 @@ func (ec *executionContext) _Footprints_nodehours(ctx context.Context, field gra
|
|||||||
}()
|
}()
|
||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return obj.Nodehours, nil
|
return obj.Timeweights, nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ec.Error(ctx, err)
|
ec.Error(ctx, err)
|
||||||
@ -2784,7 +2784,7 @@ func (ec *executionContext) _Footprints_nodehours(ctx context.Context, field gra
|
|||||||
return ec.marshalNNullableFloat2ᚕgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐFloatᚄ(ctx, field.Selections, res)
|
return ec.marshalNNullableFloat2ᚕgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋpkgᚋschemaᚐFloatᚄ(ctx, field.Selections, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) fieldContext_Footprints_nodehours(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
func (ec *executionContext) fieldContext_Footprints_timeweights(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
fc = &graphql.FieldContext{
|
fc = &graphql.FieldContext{
|
||||||
Object: "Footprints",
|
Object: "Footprints",
|
||||||
Field: field,
|
Field: field,
|
||||||
@ -6945,8 +6945,8 @@ func (ec *executionContext) fieldContext_Query_jobsFootprints(ctx context.Contex
|
|||||||
IsResolver: true,
|
IsResolver: true,
|
||||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
switch field.Name {
|
switch field.Name {
|
||||||
case "nodehours":
|
case "timeweights":
|
||||||
return ec.fieldContext_Footprints_nodehours(ctx, field)
|
return ec.fieldContext_Footprints_timeweights(ctx, field)
|
||||||
case "metrics":
|
case "metrics":
|
||||||
return ec.fieldContext_Footprints_metrics(ctx, field)
|
return ec.fieldContext_Footprints_metrics(ctx, field)
|
||||||
}
|
}
|
||||||
@ -11715,9 +11715,9 @@ func (ec *executionContext) _Footprints(ctx context.Context, sel ast.SelectionSe
|
|||||||
switch field.Name {
|
switch field.Name {
|
||||||
case "__typename":
|
case "__typename":
|
||||||
out.Values[i] = graphql.MarshalString("Footprints")
|
out.Values[i] = graphql.MarshalString("Footprints")
|
||||||
case "nodehours":
|
case "timeweights":
|
||||||
|
|
||||||
out.Values[i] = ec._Footprints_nodehours(ctx, field, obj)
|
out.Values[i] = ec._Footprints_timeweights(ctx, field, obj)
|
||||||
|
|
||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
invalids++
|
invalids++
|
||||||
|
@ -22,8 +22,8 @@ type FloatRange struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Footprints struct {
|
type Footprints struct {
|
||||||
Nodehours []schema.Float `json:"nodehours"`
|
Timeweights []schema.Float `json:"timeweights"`
|
||||||
Metrics []*MetricFootprints `json:"metrics"`
|
Metrics []*MetricFootprints `json:"metrics"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type HistoPoint struct {
|
type HistoPoint struct {
|
||||||
|
@ -107,6 +107,8 @@ func (r *queryResolver) jobsFootprints(ctx context.Context, filter []*model.JobF
|
|||||||
}
|
}
|
||||||
|
|
||||||
nodehours := make([]schema.Float, 0, len(jobs))
|
nodehours := make([]schema.Float, 0, len(jobs))
|
||||||
|
acchours := make([]schema.Float, 0, len(jobs))
|
||||||
|
hwthours := make([]schema.Float, 0, len(jobs))
|
||||||
for _, job := range jobs {
|
for _, job := range jobs {
|
||||||
if job.MonitoringStatus == schema.MonitoringStatusDisabled || job.MonitoringStatus == schema.MonitoringStatusArchivingFailed {
|
if job.MonitoringStatus == schema.MonitoringStatusDisabled || job.MonitoringStatus == schema.MonitoringStatusArchivingFailed {
|
||||||
continue
|
continue
|
||||||
@ -117,7 +119,18 @@ func (r *queryResolver) jobsFootprints(ctx context.Context, filter []*model.JobF
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #166 collect arrays: Null values or no null values?
|
||||||
nodehours = append(nodehours, schema.Float(float64(job.Duration)/60.0*float64(job.NumNodes)))
|
nodehours = append(nodehours, schema.Float(float64(job.Duration)/60.0*float64(job.NumNodes)))
|
||||||
|
if job.NumAcc > 0 {
|
||||||
|
acchours = append(acchours, schema.Float(float64(job.Duration)/60.0*float64(job.NumAcc)))
|
||||||
|
} else {
|
||||||
|
acchours = append(acchours, schema.Float(0.0))
|
||||||
|
}
|
||||||
|
if job.NumHWThreads > 0 {
|
||||||
|
hwthours = append(hwthours, schema.Float(float64(job.Duration)/60.0*float64(job.NumHWThreads)))
|
||||||
|
} else {
|
||||||
|
hwthours = append(hwthours, schema.Float(0.0))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res := make([]*model.MetricFootprints, len(avgs))
|
res := make([]*model.MetricFootprints, len(avgs))
|
||||||
@ -129,8 +142,8 @@ func (r *queryResolver) jobsFootprints(ctx context.Context, filter []*model.JobF
|
|||||||
}
|
}
|
||||||
|
|
||||||
return &model.Footprints{
|
return &model.Footprints{
|
||||||
Nodehours: nodehours,
|
Timeweights: nodehours,
|
||||||
Metrics: res,
|
Metrics: res,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ func (ccms *CCMetricStore) LoadStats(
|
|||||||
metrics []string,
|
metrics []string,
|
||||||
ctx context.Context) (map[string]map[string]schema.MetricStatistics, error) {
|
ctx context.Context) (map[string]map[string]schema.MetricStatistics, error) {
|
||||||
|
|
||||||
queries, _, err := ccms.buildQueries(job, metrics, []schema.MetricScope{schema.MetricScopeNode})
|
queries, _, err := ccms.buildQueries(job, metrics, []schema.MetricScope{schema.MetricScopeNode}) // #166 Add scope shere for analysis view accelerator normalization?
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn("Error while building query")
|
log.Warn("Error while building query")
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -182,7 +182,7 @@ func LoadAverages(
|
|||||||
ctx context.Context) error {
|
ctx context.Context) error {
|
||||||
|
|
||||||
if job.State != schema.JobStateRunning && useArchive {
|
if job.State != schema.JobStateRunning && useArchive {
|
||||||
return archive.LoadAveragesFromArchive(job, metrics, data)
|
return archive.LoadAveragesFromArchive(job, metrics, data) // #166 change also here
|
||||||
}
|
}
|
||||||
|
|
||||||
repo, ok := metricDataRepos[job.Cluster]
|
repo, ok := metricDataRepos[job.Cluster]
|
||||||
@ -190,7 +190,7 @@ func LoadAverages(
|
|||||||
return fmt.Errorf("METRICDATA/METRICDATA > no metric data repository configured for '%s'", job.Cluster)
|
return fmt.Errorf("METRICDATA/METRICDATA > no metric data repository configured for '%s'", job.Cluster)
|
||||||
}
|
}
|
||||||
|
|
||||||
stats, err := repo.LoadStats(job, metrics, ctx)
|
stats, err := repo.LoadStats(job, metrics, ctx) // #166 how to handle stats for acc normalizazion?
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Error while loading statistics for job %v (User %v, Project %v)", job.JobID, job.User, job.Project)
|
log.Errorf("Error while loading statistics for job %v (User %v, Project %v)", job.JobID, job.User, job.Project)
|
||||||
return err
|
return err
|
||||||
|
@ -76,7 +76,7 @@
|
|||||||
query: gql`
|
query: gql`
|
||||||
query($jobFilters: [JobFilter!]!, $metrics: [String!]!) {
|
query($jobFilters: [JobFilter!]!, $metrics: [String!]!) {
|
||||||
footprints: jobsFootprints(filter: $jobFilters, metrics: $metrics) {
|
footprints: jobsFootprints(filter: $jobFilters, metrics: $metrics) {
|
||||||
nodehours,
|
timeweights,
|
||||||
metrics { metric, data }
|
metrics { metric, data }
|
||||||
}
|
}
|
||||||
}`,
|
}`,
|
||||||
@ -229,7 +229,7 @@
|
|||||||
let:width
|
let:width
|
||||||
renderFor="analysis"
|
renderFor="analysis"
|
||||||
items={metricsInHistograms.map(metric => ({ metric, ...binsFromFootprint(
|
items={metricsInHistograms.map(metric => ({ metric, ...binsFromFootprint(
|
||||||
$footprintsQuery.data.footprints.nodehours,
|
$footprintsQuery.data.footprints.timeweights,
|
||||||
$footprintsQuery.data.footprints.metrics.find(f => f.metric == metric).data, numBins) }))}
|
$footprintsQuery.data.footprints.metrics.find(f => f.metric == metric).data, numBins) }))}
|
||||||
itemsPerRow={ccconfig.plot_view_plotsPerRow}>
|
itemsPerRow={ccconfig.plot_view_plotsPerRow}>
|
||||||
|
|
||||||
@ -271,7 +271,7 @@
|
|||||||
(metricConfig(cluster.name, item.m1)?.unit?.base ? metricConfig(cluster.name, item.m1)?.unit?.base : '')}]`}
|
(metricConfig(cluster.name, item.m1)?.unit?.base ? metricConfig(cluster.name, item.m1)?.unit?.base : '')}]`}
|
||||||
yLabel={`${item.m2} [${(metricConfig(cluster.name, item.m2)?.unit?.prefix ? metricConfig(cluster.name, item.m2)?.unit?.prefix : '') +
|
yLabel={`${item.m2} [${(metricConfig(cluster.name, item.m2)?.unit?.prefix ? metricConfig(cluster.name, item.m2)?.unit?.prefix : '') +
|
||||||
(metricConfig(cluster.name, item.m2)?.unit?.base ? metricConfig(cluster.name, item.m2)?.unit?.base : '')}]`}
|
(metricConfig(cluster.name, item.m2)?.unit?.base ? metricConfig(cluster.name, item.m2)?.unit?.base : '')}]`}
|
||||||
X={item.f1} Y={item.f2} S={$footprintsQuery.data.footprints.nodehours} />
|
X={item.f1} Y={item.f2} S={$footprintsQuery.data.footprints.timeweights} />
|
||||||
</PlotTable>
|
</PlotTable>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
Loading…
Reference in New Issue
Block a user