mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-05-14 05:01:41 +02:00
add job starttime to legend
This commit is contained in:
parent
1d13d3dccf
commit
fd52fdd35b
@ -172,6 +172,7 @@ type ScopedStats {
|
|||||||
|
|
||||||
type JobStats {
|
type JobStats {
|
||||||
jobId: Int!
|
jobId: Int!
|
||||||
|
startTime: Int!
|
||||||
stats: [NamedStats!]!
|
stats: [NamedStats!]!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,8 +171,9 @@ type ComplexityRoot struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JobStats struct {
|
JobStats struct {
|
||||||
JobID func(childComplexity int) int
|
JobID func(childComplexity int) int
|
||||||
Stats func(childComplexity int) int
|
StartTime func(childComplexity int) int
|
||||||
|
Stats func(childComplexity int) int
|
||||||
}
|
}
|
||||||
|
|
||||||
JobsStatistics struct {
|
JobsStatistics struct {
|
||||||
@ -947,6 +948,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
|
|
||||||
return e.complexity.JobStats.JobID(childComplexity), true
|
return e.complexity.JobStats.JobID(childComplexity), true
|
||||||
|
|
||||||
|
case "JobStats.startTime":
|
||||||
|
if e.complexity.JobStats.StartTime == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.JobStats.StartTime(childComplexity), true
|
||||||
|
|
||||||
case "JobStats.stats":
|
case "JobStats.stats":
|
||||||
if e.complexity.JobStats.Stats == nil {
|
if e.complexity.JobStats.Stats == nil {
|
||||||
break
|
break
|
||||||
@ -2281,6 +2289,7 @@ type ScopedStats {
|
|||||||
|
|
||||||
type JobStats {
|
type JobStats {
|
||||||
jobId: Int!
|
jobId: Int!
|
||||||
|
startTime: Int!
|
||||||
stats: [NamedStats!]!
|
stats: [NamedStats!]!
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7400,6 +7409,50 @@ func (ec *executionContext) fieldContext_JobStats_jobId(_ context.Context, field
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _JobStats_startTime(ctx context.Context, field graphql.CollectedField, obj *model.JobStats) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_JobStats_startTime(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) (any, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.StartTime, 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.(int)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalNInt2int(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_JobStats_startTime(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "JobStats",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
return nil, errors.New("field of type Int does not have child fields")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _JobStats_stats(ctx context.Context, field graphql.CollectedField, obj *model.JobStats) (ret graphql.Marshaler) {
|
func (ec *executionContext) _JobStats_stats(ctx context.Context, field graphql.CollectedField, obj *model.JobStats) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_JobStats_stats(ctx, field)
|
fc, err := ec.fieldContext_JobStats_stats(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -11197,6 +11250,8 @@ func (ec *executionContext) fieldContext_Query_jobsMetricStats(ctx context.Conte
|
|||||||
switch field.Name {
|
switch field.Name {
|
||||||
case "jobId":
|
case "jobId":
|
||||||
return ec.fieldContext_JobStats_jobId(ctx, field)
|
return ec.fieldContext_JobStats_jobId(ctx, field)
|
||||||
|
case "startTime":
|
||||||
|
return ec.fieldContext_JobStats_startTime(ctx, field)
|
||||||
case "stats":
|
case "stats":
|
||||||
return ec.fieldContext_JobStats_stats(ctx, field)
|
return ec.fieldContext_JobStats_stats(ctx, field)
|
||||||
}
|
}
|
||||||
@ -17527,6 +17582,11 @@ func (ec *executionContext) _JobStats(ctx context.Context, sel ast.SelectionSet,
|
|||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
out.Invalids++
|
out.Invalids++
|
||||||
}
|
}
|
||||||
|
case "startTime":
|
||||||
|
out.Values[i] = ec._JobStats_startTime(ctx, field, obj)
|
||||||
|
if out.Values[i] == graphql.Null {
|
||||||
|
out.Invalids++
|
||||||
|
}
|
||||||
case "stats":
|
case "stats":
|
||||||
out.Values[i] = ec._JobStats_stats(ctx, field, obj)
|
out.Values[i] = ec._JobStats_stats(ctx, field, obj)
|
||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
|
@ -97,8 +97,9 @@ type JobResultList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type JobStats struct {
|
type JobStats struct {
|
||||||
JobID int `json:"jobId"`
|
JobID int `json:"jobId"`
|
||||||
Stats []*NamedStats `json:"stats"`
|
StartTime int `json:"startTime"`
|
||||||
|
Stats []*NamedStats `json:"stats"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type JobsStatistics struct {
|
type JobsStatistics struct {
|
||||||
|
@ -616,8 +616,9 @@ func (r *queryResolver) JobsMetricStats(ctx context.Context, filter []*model.Job
|
|||||||
}
|
}
|
||||||
|
|
||||||
res = append(res, &model.JobStats{
|
res = append(res, &model.JobStats{
|
||||||
JobID: int(job.JobID),
|
JobID: int(job.JobID),
|
||||||
Stats: sres,
|
StartTime: int(job.StartTime.Unix()),
|
||||||
|
Stats: sres,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
let filter = [...filterBuffer];
|
let filter = [...filterBuffer];
|
||||||
let comparePlotData = {};
|
let comparePlotData = {};
|
||||||
let jobIds = [];
|
let jobIds = [];
|
||||||
|
let jobStarts = [];
|
||||||
const sorting = { field: "startTime", type: "col", order: "DESC" };
|
const sorting = { field: "startTime", type: "col", order: "DESC" };
|
||||||
|
|
||||||
/* GQL */
|
/* GQL */
|
||||||
@ -49,6 +50,7 @@
|
|||||||
query ($filter: [JobFilter!]!, $metrics: [String!]!) {
|
query ($filter: [JobFilter!]!, $metrics: [String!]!) {
|
||||||
jobsMetricStats(filter: $filter, metrics: $metrics) {
|
jobsMetricStats(filter: $filter, metrics: $metrics) {
|
||||||
jobId
|
jobId
|
||||||
|
startTime
|
||||||
stats {
|
stats {
|
||||||
name
|
name
|
||||||
data {
|
data {
|
||||||
@ -72,6 +74,7 @@
|
|||||||
$: matchedCompareJobs = $compareData.data != null ? $compareData.data.jobsMetricStats.length : -1;
|
$: matchedCompareJobs = $compareData.data != null ? $compareData.data.jobsMetricStats.length : -1;
|
||||||
$: if ($compareData.data != null) {
|
$: if ($compareData.data != null) {
|
||||||
jobIds = [];
|
jobIds = [];
|
||||||
|
jobStarts = [];
|
||||||
comparePlotData = {}
|
comparePlotData = {}
|
||||||
jobs2uplot($compareData.data.jobsMetricStats, metrics)
|
jobs2uplot($compareData.data.jobsMetricStats, metrics)
|
||||||
}
|
}
|
||||||
@ -121,7 +124,9 @@
|
|||||||
let plotIndex = 0
|
let plotIndex = 0
|
||||||
jobs.forEach((j) => {
|
jobs.forEach((j) => {
|
||||||
jobIds.push(j.jobId)
|
jobIds.push(j.jobId)
|
||||||
|
jobStarts.push(j.startTime)
|
||||||
for (let s of j.stats) {
|
for (let s of j.stats) {
|
||||||
|
// comparePlotData[s.name].data[0].push(j.startTime)
|
||||||
comparePlotData[s.name].data[0].push(plotIndex)
|
comparePlotData[s.name].data[0].push(plotIndex)
|
||||||
comparePlotData[s.name].data[1].push(s.data.min)
|
comparePlotData[s.name].data[1].push(s.data.min)
|
||||||
comparePlotData[s.name].data[2].push(s.data.avg)
|
comparePlotData[s.name].data[2].push(s.data.avg)
|
||||||
@ -181,6 +186,7 @@
|
|||||||
title={'Compare '+ m}
|
title={'Compare '+ m}
|
||||||
xlabel="JobIds"
|
xlabel="JobIds"
|
||||||
xticks={jobIds}
|
xticks={jobIds}
|
||||||
|
xtimes={jobStarts}
|
||||||
ylabel={m}
|
ylabel={m}
|
||||||
metric={m}
|
metric={m}
|
||||||
yunit={comparePlotData[m].unit}
|
yunit={comparePlotData[m].unit}
|
||||||
@ -188,9 +194,10 @@
|
|||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
<hr/><hr/>
|
<hr/><hr/>
|
||||||
{#each $compareData.data.jobsMetricStats as job (job.jobId)}
|
{#each $compareData.data.jobsMetricStats as job, jindex (job.jobId)}
|
||||||
<Row>
|
<Row>
|
||||||
<Col><b><i>{job.jobId}</i></b></Col>
|
<Col><b>{jindex}: <i>{job.jobId}</i></b></Col>
|
||||||
|
<Col><i>{new Date(job.startTime * 1000)}</i></Col>
|
||||||
{#each job.stats as stat (stat.name)}
|
{#each job.stats as stat (stat.name)}
|
||||||
<Col><b>{stat.name}</b></Col>
|
<Col><b>{stat.name}</b></Col>
|
||||||
<Col>Min {stat.data.min}</Col>
|
<Col>Min {stat.data.min}</Col>
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
export let data;
|
export let data;
|
||||||
export let xlabel;
|
export let xlabel;
|
||||||
export let xticks;
|
export let xticks;
|
||||||
|
export let xtimes;
|
||||||
export let ylabel;
|
export let ylabel;
|
||||||
export let yunit;
|
export let yunit;
|
||||||
export let title;
|
export let title;
|
||||||
@ -120,7 +121,7 @@
|
|||||||
{
|
{
|
||||||
label: "JobID",
|
label: "JobID",
|
||||||
value: (u, ts, sidx, didx) => {
|
value: (u, ts, sidx, didx) => {
|
||||||
return xticks[didx];
|
return xticks[didx] + ' (' + new Date(xtimes[didx] * 1000).toLocaleString() + ')';
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user