mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-27 05:49:04 +01:00
Add partition and array-job-id filters
This commit is contained in:
parent
f8ad53caf0
commit
9e92d6076f
@ -1346,9 +1346,11 @@ type FilterRanges {
|
|||||||
input JobFilter {
|
input JobFilter {
|
||||||
tags: [ID!]
|
tags: [ID!]
|
||||||
jobId: StringInput
|
jobId: StringInput
|
||||||
|
arrayJobId: Int
|
||||||
user: StringInput
|
user: StringInput
|
||||||
project: StringInput
|
project: StringInput
|
||||||
cluster: StringInput
|
cluster: StringInput
|
||||||
|
partition: StringInput
|
||||||
duration: IntRange
|
duration: IntRange
|
||||||
numNodes: IntRange
|
numNodes: IntRange
|
||||||
startTime: TimeRange
|
startTime: TimeRange
|
||||||
@ -7013,6 +7015,14 @@ func (ec *executionContext) unmarshalInputJobFilter(ctx context.Context, obj int
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return it, err
|
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":
|
case "user":
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
@ -7037,6 +7047,14 @@ func (ec *executionContext) unmarshalInputJobFilter(ctx context.Context, obj int
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return it, err
|
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":
|
case "duration":
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
|
@ -46,9 +46,11 @@ type IntRangeOutput struct {
|
|||||||
type JobFilter struct {
|
type JobFilter struct {
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
JobID *StringInput `json:"jobId"`
|
JobID *StringInput `json:"jobId"`
|
||||||
|
ArrayJobID *int `json:"arrayJobId"`
|
||||||
User *StringInput `json:"user"`
|
User *StringInput `json:"user"`
|
||||||
Project *StringInput `json:"project"`
|
Project *StringInput `json:"project"`
|
||||||
Cluster *StringInput `json:"cluster"`
|
Cluster *StringInput `json:"cluster"`
|
||||||
|
Partition *StringInput `json:"partition"`
|
||||||
Duration *IntRange `json:"duration"`
|
Duration *IntRange `json:"duration"`
|
||||||
NumNodes *IntRange `json:"numNodes"`
|
NumNodes *IntRange `json:"numNodes"`
|
||||||
StartTime *TimeRange `json:"startTime"`
|
StartTime *TimeRange `json:"startTime"`
|
||||||
|
@ -124,6 +124,9 @@ func buildWhereClause(filter *model.JobFilter, query sq.SelectBuilder) sq.Select
|
|||||||
if filter.JobID != nil {
|
if filter.JobID != nil {
|
||||||
query = buildStringCondition("job.job_id", filter.JobID, query)
|
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 {
|
if filter.User != nil {
|
||||||
query = buildStringCondition("job.user", filter.User, query)
|
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 {
|
if filter.Cluster != nil {
|
||||||
query = buildStringCondition("job.cluster", filter.Cluster, query)
|
query = buildStringCondition("job.cluster", filter.Cluster, query)
|
||||||
}
|
}
|
||||||
|
if filter.Partition != nil {
|
||||||
|
query = buildStringCondition("job.partition", filter.Partition, query)
|
||||||
|
}
|
||||||
if filter.StartTime != nil {
|
if filter.StartTime != nil {
|
||||||
query = buildTimeCondition("job.start_time", filter.StartTime, query)
|
query = buildTimeCondition("job.start_time", filter.StartTime, query)
|
||||||
}
|
}
|
||||||
|
@ -168,9 +168,11 @@ type FilterRanges {
|
|||||||
input JobFilter {
|
input JobFilter {
|
||||||
tags: [ID!]
|
tags: [ID!]
|
||||||
jobId: StringInput
|
jobId: StringInput
|
||||||
|
arrayJobId: Int
|
||||||
user: StringInput
|
user: StringInput
|
||||||
project: StringInput
|
project: StringInput
|
||||||
cluster: StringInput
|
cluster: StringInput
|
||||||
|
partition: StringInput
|
||||||
duration: IntRange
|
duration: IntRange
|
||||||
numNodes: IntRange
|
numNodes: IntRange
|
||||||
startTime: TimeRange
|
startTime: TimeRange
|
||||||
|
@ -388,6 +388,9 @@ func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) {
|
|||||||
if query.Get("cluster") != "" {
|
if query.Get("cluster") != "" {
|
||||||
filterPresets["cluster"] = query.Get("cluster")
|
filterPresets["cluster"] = query.Get("cluster")
|
||||||
}
|
}
|
||||||
|
if query.Get("partition") != "" {
|
||||||
|
filterPresets["partition"] = query.Get("partition")
|
||||||
|
}
|
||||||
if query.Get("project") != "" {
|
if query.Get("project") != "" {
|
||||||
filterPresets["project"] = query.Get("project")
|
filterPresets["project"] = query.Get("project")
|
||||||
filterPresets["projectMatch"] = "eq"
|
filterPresets["projectMatch"] = "eq"
|
||||||
@ -419,6 +422,11 @@ func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) {
|
|||||||
if query.Get("jobId") != "" {
|
if query.Get("jobId") != "" {
|
||||||
filterPresets["jobId"] = 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
|
return filterPresets
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user