From 7e32855030d9994137fe5d57dfb6b4a76bab5526 Mon Sep 17 00:00:00 2001 From: Lou Knauer Date: Mon, 12 Apr 2021 14:01:59 +0200 Subject: [PATCH] remove JobData, add hasProfile, rename Job-Metrics-Query --- graph/generated/generated.go | 1053 ++-------------------------------- graph/model/models_gen.go | 22 - graph/resolver.go | 25 +- graph/schema.graphqls | 28 +- server.go | 2 +- 5 files changed, 56 insertions(+), 1074 deletions(-) diff --git a/graph/generated/generated.go b/graph/generated/generated.go index e105bbc..6548415 100644 --- a/graph/generated/generated.go +++ b/graph/generated/generated.go @@ -49,36 +49,14 @@ type ComplexityRoot struct { } Job struct { - ClusterID func(childComplexity int) int - Duration func(childComplexity int) int - ID func(childComplexity int) int - JobID func(childComplexity int) int - NumNodes func(childComplexity int) int - ProjectID func(childComplexity int) int - StartTime func(childComplexity int) int - UserID func(childComplexity int) int - } - - JobData struct { - ClockSpeed func(childComplexity int) int - CongestionIb func(childComplexity int) int - CpiAvg func(childComplexity int) int - FlopsAny func(childComplexity int) int - FlopsDp func(childComplexity int) int - FlopsSp func(childComplexity int) int - InodesLustre func(childComplexity int) int - LoadOne func(childComplexity int) int - MemBw func(childComplexity int) int - MemUsed func(childComplexity int) int - PkgRateReadIb func(childComplexity int) int - PkgRateWriteIb func(childComplexity int) int - RegReadLustre func(childComplexity int) int - RegWriteLustre func(childComplexity int) int - TotalPower func(childComplexity int) int - TrafficReadEth func(childComplexity int) int - TrafficReadLustre func(childComplexity int) int - TrafficWriteEth func(childComplexity int) int - TrafficWriteLustre func(childComplexity int) int + ClusterID func(childComplexity int) int + Duration func(childComplexity int) int + HasProfile func(childComplexity int) int + JobID func(childComplexity int) int + NumNodes func(childComplexity int) int + ProjectID func(childComplexity int) int + StartTime func(childComplexity int) int + UserID func(childComplexity int) int } JobMetric struct { @@ -122,11 +100,10 @@ type ComplexityRoot struct { } Query struct { - JobAvailableMetricsByID func(childComplexity int, jobID string, selectMetrics []*string) int - JobByID func(childComplexity int, jobID string) int - JobDataByID func(childComplexity int, jobID string) int - Jobs func(childComplexity int, filter *model.JobFilterList, page *model.PageRequest, order *model.OrderByInput) int - JobsStatistics func(childComplexity int, filter *model.JobFilterList) int + JobByID func(childComplexity int, jobID string) int + JobMetrics func(childComplexity int, jobID string, metrics []*string) int + Jobs func(childComplexity int, filter *model.JobFilterList, page *model.PageRequest, order *model.OrderByInput) int + JobsStatistics func(childComplexity int, filter *model.JobFilterList) int } } @@ -134,8 +111,7 @@ type QueryResolver interface { JobByID(ctx context.Context, jobID string) (*model.Job, error) Jobs(ctx context.Context, filter *model.JobFilterList, page *model.PageRequest, order *model.OrderByInput) (*model.JobResultList, error) JobsStatistics(ctx context.Context, filter *model.JobFilterList) (*model.JobsStatistics, error) - JobDataByID(ctx context.Context, jobID string) (*model.JobData, error) - JobAvailableMetricsByID(ctx context.Context, jobID string, selectMetrics []*string) ([]*model.JobMetricWithName, error) + JobMetrics(ctx context.Context, jobID string, metrics []*string) ([]*model.JobMetricWithName, error) } type executableSchema struct { @@ -181,12 +157,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Job.Duration(childComplexity), true - case "Job.id": - if e.complexity.Job.ID == nil { + case "Job.hasProfile": + if e.complexity.Job.HasProfile == nil { break } - return e.complexity.Job.ID(childComplexity), true + return e.complexity.Job.HasProfile(childComplexity), true case "Job.jobId": if e.complexity.Job.JobID == nil { @@ -223,139 +199,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Job.UserID(childComplexity), true - case "JobData.clock_speed": - if e.complexity.JobData.ClockSpeed == nil { - break - } - - return e.complexity.JobData.ClockSpeed(childComplexity), true - - case "JobData.congestion_ib": - if e.complexity.JobData.CongestionIb == nil { - break - } - - return e.complexity.JobData.CongestionIb(childComplexity), true - - case "JobData.cpi_avg": - if e.complexity.JobData.CpiAvg == nil { - break - } - - return e.complexity.JobData.CpiAvg(childComplexity), true - - case "JobData.flops_any": - if e.complexity.JobData.FlopsAny == nil { - break - } - - return e.complexity.JobData.FlopsAny(childComplexity), true - - case "JobData.flops_dp": - if e.complexity.JobData.FlopsDp == nil { - break - } - - return e.complexity.JobData.FlopsDp(childComplexity), true - - case "JobData.flops_sp": - if e.complexity.JobData.FlopsSp == nil { - break - } - - return e.complexity.JobData.FlopsSp(childComplexity), true - - case "JobData.inodes_lustre": - if e.complexity.JobData.InodesLustre == nil { - break - } - - return e.complexity.JobData.InodesLustre(childComplexity), true - - case "JobData.load_one": - if e.complexity.JobData.LoadOne == nil { - break - } - - return e.complexity.JobData.LoadOne(childComplexity), true - - case "JobData.mem_bw": - if e.complexity.JobData.MemBw == nil { - break - } - - return e.complexity.JobData.MemBw(childComplexity), true - - case "JobData.mem_used": - if e.complexity.JobData.MemUsed == nil { - break - } - - return e.complexity.JobData.MemUsed(childComplexity), true - - case "JobData.pkg_rate_read_ib": - if e.complexity.JobData.PkgRateReadIb == nil { - break - } - - return e.complexity.JobData.PkgRateReadIb(childComplexity), true - - case "JobData.pkg_rate_write_ib": - if e.complexity.JobData.PkgRateWriteIb == nil { - break - } - - return e.complexity.JobData.PkgRateWriteIb(childComplexity), true - - case "JobData.reg_read_lustre": - if e.complexity.JobData.RegReadLustre == nil { - break - } - - return e.complexity.JobData.RegReadLustre(childComplexity), true - - case "JobData.reg_write_lustre": - if e.complexity.JobData.RegWriteLustre == nil { - break - } - - return e.complexity.JobData.RegWriteLustre(childComplexity), true - - case "JobData.total_power": - if e.complexity.JobData.TotalPower == nil { - break - } - - return e.complexity.JobData.TotalPower(childComplexity), true - - case "JobData.traffic_read_eth": - if e.complexity.JobData.TrafficReadEth == nil { - break - } - - return e.complexity.JobData.TrafficReadEth(childComplexity), true - - case "JobData.traffic_read_lustre": - if e.complexity.JobData.TrafficReadLustre == nil { - break - } - - return e.complexity.JobData.TrafficReadLustre(childComplexity), true - - case "JobData.traffic_write_eth": - if e.complexity.JobData.TrafficWriteEth == nil { - break - } - - return e.complexity.JobData.TrafficWriteEth(childComplexity), true - - case "JobData.traffic_write_lustre": - if e.complexity.JobData.TrafficWriteLustre == nil { - break - } - - return e.complexity.JobData.TrafficWriteLustre(childComplexity), true - case "JobMetric.scope": if e.complexity.JobMetric.Scope == nil { break @@ -510,18 +353,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.JobsStatistics.TotalWalltime(childComplexity), true - case "Query.jobAvailableMetricsById": - if e.complexity.Query.JobAvailableMetricsByID == nil { - break - } - - args, err := ec.field_Query_jobAvailableMetricsById_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.JobAvailableMetricsByID(childComplexity, args["jobId"].(string), args["selectMetrics"].([]*string)), true - case "Query.jobById": if e.complexity.Query.JobByID == nil { break @@ -534,17 +365,17 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.JobByID(childComplexity, args["jobId"].(string)), true - case "Query.jobDataById": - if e.complexity.Query.JobDataByID == nil { + case "Query.jobMetrics": + if e.complexity.Query.JobMetrics == nil { break } - args, err := ec.field_Query_jobDataById_args(context.TODO(), rawArgs) + args, err := ec.field_Query_jobMetrics_args(context.TODO(), rawArgs) if err != nil { return 0, false } - return e.complexity.Query.JobDataByID(childComplexity, args["jobId"].(string)), true + return e.complexity.Query.JobMetrics(childComplexity, args["jobId"].(string), args["metrics"].([]*string)), true case "Query.jobs": if e.complexity.Query.Jobs == nil { @@ -621,7 +452,6 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er var sources = []*ast.Source{ {Name: "graph/schema.graphqls", Input: `type Job { - id: ID! jobId: String! userId: String! projectId: String! @@ -629,28 +459,7 @@ var sources = []*ast.Source{ startTime: Time! duration: Int! numNodes: Int! -} - -type JobData { - load_one: JobMetric - mem_used: JobMetric - mem_bw: JobMetric - flops_any: JobMetric - flops_dp: JobMetric - flops_sp: JobMetric - cpi_avg: JobMetric - clock_speed: JobMetric - total_power: JobMetric - traffic_read_eth: JobMetric - traffic_write_eth: JobMetric - traffic_read_lustre: JobMetric - traffic_write_lustre: JobMetric - reg_read_lustre: JobMetric - reg_write_lustre: JobMetric - inodes_lustre: JobMetric - pkg_rate_read_ib: JobMetric - pkg_rate_write_ib: JobMetric - congestion_ib: JobMetric + hasProfile: Boolean! } type JobMetric { @@ -682,9 +491,7 @@ type Query { jobById(jobId: String!): Job jobs(filter: JobFilterList, page: PageRequest, order: OrderByInput): JobResultList! jobsStatistics(filter: JobFilterList): JobsStatistics! - - jobDataById(jobId: String!): JobData - jobAvailableMetricsById(jobId: String!, selectMetrics: [String]): [JobMetricWithName]! + jobMetrics(jobId: String!, metrics: [String]): [JobMetricWithName]! } input StartJobInput { @@ -813,30 +620,6 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field_Query_jobAvailableMetricsById_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["jobId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("jobId")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["jobId"] = arg0 - var arg1 []*string - if tmp, ok := rawArgs["selectMetrics"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("selectMetrics")) - arg1, err = ec.unmarshalOString2ᚕᚖstring(ctx, tmp) - if err != nil { - return nil, err - } - } - args["selectMetrics"] = arg1 - return args, nil -} - func (ec *executionContext) field_Query_jobById_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -852,7 +635,7 @@ func (ec *executionContext) field_Query_jobById_args(ctx context.Context, rawArg return args, nil } -func (ec *executionContext) field_Query_jobDataById_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_jobMetrics_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string @@ -864,6 +647,15 @@ func (ec *executionContext) field_Query_jobDataById_args(ctx context.Context, ra } } args["jobId"] = arg0 + var arg1 []*string + if tmp, ok := rawArgs["metrics"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("metrics")) + arg1, err = ec.unmarshalOString2ᚕᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["metrics"] = arg1 return args, nil } @@ -1023,41 +815,6 @@ func (ec *executionContext) _HistoPoint_value(ctx context.Context, field graphql return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _Job_id(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Job", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ID, 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.(string) - fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) -} - func (ec *executionContext) _Job_jobId(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -1303,7 +1060,7 @@ func (ec *executionContext) _Job_numNodes(ctx context.Context, field graphql.Col return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _JobData_load_one(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { +func (ec *executionContext) _Job_hasProfile(ctx context.Context, field graphql.CollectedField, obj *model.Job) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -1311,7 +1068,7 @@ func (ec *executionContext) _JobData_load_one(ctx context.Context, field graphql } }() fc := &graphql.FieldContext{ - Object: "JobData", + Object: "Job", Field: field, Args: nil, IsMethod: false, @@ -1321,594 +1078,21 @@ func (ec *executionContext) _JobData_load_one(ctx context.Context, field graphql ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.LoadOne, nil + return obj.HasProfile, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_mem_used(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.MemUsed, nil - }) - if err != nil { - ec.Error(ctx, err) return graphql.Null } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) + res := resTmp.(bool) fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_mem_bw(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.MemBw, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_flops_any(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.FlopsAny, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_flops_dp(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.FlopsDp, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_flops_sp(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.FlopsSp, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_cpi_avg(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.CpiAvg, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_clock_speed(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ClockSpeed, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_total_power(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.TotalPower, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_traffic_read_eth(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.TrafficReadEth, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_traffic_write_eth(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.TrafficWriteEth, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_traffic_read_lustre(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.TrafficReadLustre, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_traffic_write_lustre(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.TrafficWriteLustre, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_reg_read_lustre(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.RegReadLustre, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_reg_write_lustre(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.RegWriteLustre, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_inodes_lustre(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.InodesLustre, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_pkg_rate_read_ib(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.PkgRateReadIb, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_pkg_rate_write_ib(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.PkgRateWriteIb, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) -} - -func (ec *executionContext) _JobData_congestion_ib(ctx context.Context, field graphql.CollectedField, obj *model.JobData) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "JobData", - Field: field, - Args: nil, - IsMethod: false, - IsResolver: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.CongestionIb, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobMetric) - fc.Result = res - return ec.marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) _JobMetric_unit(ctx context.Context, field graphql.CollectedField, obj *model.JobMetric) (ret graphql.Marshaler) { @@ -2792,7 +1976,7 @@ func (ec *executionContext) _Query_jobsStatistics(ctx context.Context, field gra return ec.marshalNJobsStatistics2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobsStatistics(ctx, field.Selections, res) } -func (ec *executionContext) _Query_jobDataById(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_jobMetrics(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -2809,7 +1993,7 @@ func (ec *executionContext) _Query_jobDataById(ctx context.Context, field graphq ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_jobDataById_args(ctx, rawArgs) + args, err := ec.field_Query_jobMetrics_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null @@ -2817,46 +2001,7 @@ func (ec *executionContext) _Query_jobDataById(ctx context.Context, field graphq fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().JobDataByID(rctx, args["jobId"].(string)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.JobData) - fc.Result = res - return ec.marshalOJobData2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobData(ctx, field.Selections, res) -} - -func (ec *executionContext) _Query_jobAvailableMetricsById(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Query", - Field: field, - Args: nil, - IsMethod: true, - IsResolver: true, - } - - ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_jobAvailableMetricsById_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().JobAvailableMetricsByID(rctx, args["jobId"].(string), args["selectMetrics"].([]*string)) + return ec.resolvers.Query().JobMetrics(rctx, args["jobId"].(string), args["metrics"].([]*string)) }) if err != nil { ec.Error(ctx, err) @@ -4514,11 +3659,6 @@ func (ec *executionContext) _Job(ctx context.Context, sel ast.SelectionSet, obj switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("Job") - case "id": - out.Values[i] = ec._Job_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } case "jobId": out.Values[i] = ec._Job_jobId(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -4554,66 +3694,11 @@ func (ec *executionContext) _Job(ctx context.Context, sel ast.SelectionSet, obj if out.Values[i] == graphql.Null { invalids++ } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - -var jobDataImplementors = []string{"JobData"} - -func (ec *executionContext) _JobData(ctx context.Context, sel ast.SelectionSet, obj *model.JobData) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, jobDataImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("JobData") - case "load_one": - out.Values[i] = ec._JobData_load_one(ctx, field, obj) - case "mem_used": - out.Values[i] = ec._JobData_mem_used(ctx, field, obj) - case "mem_bw": - out.Values[i] = ec._JobData_mem_bw(ctx, field, obj) - case "flops_any": - out.Values[i] = ec._JobData_flops_any(ctx, field, obj) - case "flops_dp": - out.Values[i] = ec._JobData_flops_dp(ctx, field, obj) - case "flops_sp": - out.Values[i] = ec._JobData_flops_sp(ctx, field, obj) - case "cpi_avg": - out.Values[i] = ec._JobData_cpi_avg(ctx, field, obj) - case "clock_speed": - out.Values[i] = ec._JobData_clock_speed(ctx, field, obj) - case "total_power": - out.Values[i] = ec._JobData_total_power(ctx, field, obj) - case "traffic_read_eth": - out.Values[i] = ec._JobData_traffic_read_eth(ctx, field, obj) - case "traffic_write_eth": - out.Values[i] = ec._JobData_traffic_write_eth(ctx, field, obj) - case "traffic_read_lustre": - out.Values[i] = ec._JobData_traffic_read_lustre(ctx, field, obj) - case "traffic_write_lustre": - out.Values[i] = ec._JobData_traffic_write_lustre(ctx, field, obj) - case "reg_read_lustre": - out.Values[i] = ec._JobData_reg_read_lustre(ctx, field, obj) - case "reg_write_lustre": - out.Values[i] = ec._JobData_reg_write_lustre(ctx, field, obj) - case "inodes_lustre": - out.Values[i] = ec._JobData_inodes_lustre(ctx, field, obj) - case "pkg_rate_read_ib": - out.Values[i] = ec._JobData_pkg_rate_read_ib(ctx, field, obj) - case "pkg_rate_write_ib": - out.Values[i] = ec._JobData_pkg_rate_write_ib(ctx, field, obj) - case "congestion_ib": - out.Values[i] = ec._JobData_congestion_ib(ctx, field, obj) + case "hasProfile": + out.Values[i] = ec._Job_hasProfile(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -4909,7 +3994,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } return res }) - case "jobDataById": + case "jobMetrics": field := field out.Concurrently(i, func() (res graphql.Marshaler) { defer func() { @@ -4917,18 +4002,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_jobDataById(ctx, field) - return res - }) - case "jobAvailableMetricsById": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_jobAvailableMetricsById(ctx, field) + res = ec._Query_jobMetrics(ctx, field) if res == graphql.Null { atomic.AddUint32(&invalids, 1) } @@ -5291,21 +4365,6 @@ func (ec *executionContext) marshalNHistoPoint2ᚕᚖgithubᚗcomᚋClusterCockp return ret } -func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { - res, err := graphql.UnmarshalID(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - res := graphql.MarshalID(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - } - return res -} - func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { res, err := graphql.UnmarshalInt(v) return res, graphql.ErrorOnPath(ctx, err) @@ -5815,13 +4874,6 @@ func (ec *executionContext) marshalOJob2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑ return ec._Job(ctx, sel, v) } -func (ec *executionContext) marshalOJobData2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobData(ctx context.Context, sel ast.SelectionSet, v *model.JobData) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._JobData(ctx, sel, v) -} - func (ec *executionContext) unmarshalOJobFilter2ᚕᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobFilter(ctx context.Context, v interface{}) ([]*model.JobFilter, error) { if v == nil { return nil, nil @@ -5862,13 +4914,6 @@ func (ec *executionContext) unmarshalOJobFilterList2ᚖgithubᚗcomᚋClusterCoc return &res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalOJobMetric2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetric(ctx context.Context, sel ast.SelectionSet, v *model.JobMetric) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._JobMetric(ctx, sel, v) -} - func (ec *executionContext) marshalOJobMetricSeries2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑjobarchiveᚋgraphᚋmodelᚐJobMetricSeries(ctx context.Context, sel ast.SelectionSet, v *model.JobMetricSeries) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/graph/model/models_gen.go b/graph/model/models_gen.go index f9828de..25f42a8 100644 --- a/graph/model/models_gen.go +++ b/graph/model/models_gen.go @@ -34,28 +34,6 @@ type IntRange struct { To int `json:"to"` } -type JobData struct { - LoadOne *JobMetric `json:"load_one"` - MemUsed *JobMetric `json:"mem_used"` - MemBw *JobMetric `json:"mem_bw"` - FlopsAny *JobMetric `json:"flops_any"` - FlopsDp *JobMetric `json:"flops_dp"` - FlopsSp *JobMetric `json:"flops_sp"` - CpiAvg *JobMetric `json:"cpi_avg"` - ClockSpeed *JobMetric `json:"clock_speed"` - TotalPower *JobMetric `json:"total_power"` - TrafficReadEth *JobMetric `json:"traffic_read_eth"` - TrafficWriteEth *JobMetric `json:"traffic_write_eth"` - TrafficReadLustre *JobMetric `json:"traffic_read_lustre"` - TrafficWriteLustre *JobMetric `json:"traffic_write_lustre"` - RegReadLustre *JobMetric `json:"reg_read_lustre"` - RegWriteLustre *JobMetric `json:"reg_write_lustre"` - InodesLustre *JobMetric `json:"inodes_lustre"` - PkgRateReadIb *JobMetric `json:"pkg_rate_read_ib"` - PkgRateWriteIb *JobMetric `json:"pkg_rate_write_ib"` - CongestionIb *JobMetric `json:"congestion_ib"` -} - type JobFilter struct { JobID *StringInput `json:"jobId"` UserID *StringInput `json:"userId"` diff --git a/graph/resolver.go b/graph/resolver.go index 3571080..7837011 100644 --- a/graph/resolver.go +++ b/graph/resolver.go @@ -88,7 +88,7 @@ func buildQueryConditions(filterList *model.JobFilterList) string { } func readJobDataFile(jobId string) ([]byte, error) { - // TODO: What to do with the suffix? + // TODO: Use suffix as cluster-id! jobId = strings.Split(jobId, ".")[0] id, err := strconv.Atoi(jobId) if err != nil { @@ -273,26 +273,9 @@ func (r *queryResolver) JobsStatistics( return &stats, nil } -func (r *queryResolver) JobDataByID( - ctx context.Context, jobId string) (*model.JobData, error) { - - f, err := readJobDataFile(jobId) - if err != nil { - return nil, err - } - - jobData := new(model.JobData) - err = json.Unmarshal(f, jobData) - if err != nil { - return nil, err - } - - return jobData, nil -} - -func (r *queryResolver) JobAvailableMetricsByID( +func (r *queryResolver) JobMetrics( ctx context.Context, jobId string, - selectMetrics []*string) ([]*model.JobMetricWithName, error) { + metrics []*string) ([]*model.JobMetricWithName, error) { f, err := readJobDataFile(jobId) if err != nil { @@ -313,7 +296,7 @@ func (r *queryResolver) JobAvailableMetricsByID( } for name, metric := range metricMap { - if selectMetrics == nil || contains(selectMetrics, name) { + if metrics == nil || contains(metrics, name) { list = append(list, &model.JobMetricWithName{ name, metric }) } } diff --git a/graph/schema.graphqls b/graph/schema.graphqls index 1cf74cb..dffeae0 100644 --- a/graph/schema.graphqls +++ b/graph/schema.graphqls @@ -1,5 +1,4 @@ type Job { - id: ID! jobId: String! userId: String! projectId: String! @@ -7,28 +6,7 @@ type Job { startTime: Time! duration: Int! numNodes: Int! -} - -type JobData { - load_one: JobMetric - mem_used: JobMetric - mem_bw: JobMetric - flops_any: JobMetric - flops_dp: JobMetric - flops_sp: JobMetric - cpi_avg: JobMetric - clock_speed: JobMetric - total_power: JobMetric - traffic_read_eth: JobMetric - traffic_write_eth: JobMetric - traffic_read_lustre: JobMetric - traffic_write_lustre: JobMetric - reg_read_lustre: JobMetric - reg_write_lustre: JobMetric - inodes_lustre: JobMetric - pkg_rate_read_ib: JobMetric - pkg_rate_write_ib: JobMetric - congestion_ib: JobMetric + hasProfile: Boolean! } type JobMetric { @@ -60,9 +38,7 @@ type Query { jobById(jobId: String!): Job jobs(filter: JobFilterList, page: PageRequest, order: OrderByInput): JobResultList! jobsStatistics(filter: JobFilterList): JobsStatistics! - - jobDataById(jobId: String!): JobData - jobAvailableMetricsById(jobId: String!, selectMetrics: [String]): [JobMetricWithName]! + jobMetrics(jobId: String!, metrics: [String]): [JobMetricWithName]! } input StartJobInput { diff --git a/server.go b/server.go index a1f1e77..4871d15 100644 --- a/server.go +++ b/server.go @@ -36,7 +36,7 @@ func main() { r.Handle("/query", srv) log.Printf("connect to http://localhost:%s/ for GraphQL playground", port) - log.Fatal(http.ListenAndServe("127.0.0.1:8080", + log.Fatal(http.ListenAndServe("127.0.0.1:" + port, handlers.CORS(handlers.AllowedHeaders([]string{"X-Requested-With", "Content-Type", "Authorization"}), handlers.AllowedMethods([]string{"GET", "POST", "HEAD", "OPTIONS"}), handlers.AllowedOrigins([]string{"*"}))(loggedRouter)))