diff --git a/graph/generated/generated.go b/graph/generated/generated.go index 8cc686c..e9428cf 100644 --- a/graph/generated/generated.go +++ b/graph/generated/generated.go @@ -1346,9 +1346,11 @@ type FilterRanges { input JobFilter { tags: [ID!] jobId: StringInput + arrayJobId: Int user: StringInput project: StringInput cluster: StringInput + partition: StringInput duration: IntRange numNodes: IntRange startTime: TimeRange @@ -7013,6 +7015,14 @@ func (ec *executionContext) unmarshalInputJobFilter(ctx context.Context, obj int if err != nil { return it, err } + case "arrayJobId": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arrayJobId")) + it.ArrayJobID, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } case "user": var err error @@ -7037,6 +7047,14 @@ func (ec *executionContext) unmarshalInputJobFilter(ctx context.Context, obj int if err != nil { return it, err } + case "partition": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("partition")) + it.Partition, err = ec.unmarshalOStringInput2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋgraphᚋmodelᚐStringInput(ctx, v) + if err != nil { + return it, err + } case "duration": var err error diff --git a/graph/model/models_gen.go b/graph/model/models_gen.go index 9ed098b..8f570bc 100644 --- a/graph/model/models_gen.go +++ b/graph/model/models_gen.go @@ -46,9 +46,11 @@ type IntRangeOutput struct { type JobFilter struct { Tags []string `json:"tags"` JobID *StringInput `json:"jobId"` + ArrayJobID *int `json:"arrayJobId"` User *StringInput `json:"user"` Project *StringInput `json:"project"` Cluster *StringInput `json:"cluster"` + Partition *StringInput `json:"partition"` Duration *IntRange `json:"duration"` NumNodes *IntRange `json:"numNodes"` StartTime *TimeRange `json:"startTime"` diff --git a/graph/resolver.go b/graph/resolver.go index ad87444..cceef38 100644 --- a/graph/resolver.go +++ b/graph/resolver.go @@ -124,6 +124,9 @@ func buildWhereClause(filter *model.JobFilter, query sq.SelectBuilder) sq.Select if filter.JobID != nil { query = buildStringCondition("job.job_id", filter.JobID, query) } + if filter.ArrayJobID != nil { + query = query.Where("job.array_job_id = ?", *filter.ArrayJobID) + } if filter.User != nil { query = buildStringCondition("job.user", filter.User, query) } @@ -133,6 +136,9 @@ func buildWhereClause(filter *model.JobFilter, query sq.SelectBuilder) sq.Select if filter.Cluster != nil { query = buildStringCondition("job.cluster", filter.Cluster, query) } + if filter.Partition != nil { + query = buildStringCondition("job.partition", filter.Partition, query) + } if filter.StartTime != nil { query = buildTimeCondition("job.start_time", filter.StartTime, query) } diff --git a/graph/schema.graphqls b/graph/schema.graphqls index 26a8821..59bced3 100644 --- a/graph/schema.graphqls +++ b/graph/schema.graphqls @@ -168,9 +168,11 @@ type FilterRanges { input JobFilter { tags: [ID!] jobId: StringInput + arrayJobId: Int user: StringInput project: StringInput cluster: StringInput + partition: StringInput duration: IntRange numNodes: IntRange startTime: TimeRange diff --git a/server.go b/server.go index 0c8579a..22464f6 100644 --- a/server.go +++ b/server.go @@ -388,6 +388,9 @@ func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) { if query.Get("cluster") != "" { filterPresets["cluster"] = query.Get("cluster") } + if query.Get("partition") != "" { + filterPresets["partition"] = query.Get("partition") + } if query.Get("project") != "" { filterPresets["project"] = query.Get("project") filterPresets["projectMatch"] = "eq" @@ -419,6 +422,11 @@ func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) { if query.Get("jobId") != "" { filterPresets["jobId"] = query.Get("jobId") } + if query.Get("arrayJobId") != "" { + if num, err := strconv.Atoi(query.Get("arrayJobId")); err == nil { + filterPresets["arrayJobId"] = num + } + } return filterPresets }