Merge pull request #147 from ClusterCockpit/111_fix_metric_names_and_stats

111 fix metric names and stats
This commit is contained in:
Jan Eitzinger 2023-06-15 11:26:20 +02:00 committed by GitHub
commit bf9b1c7d83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 5 deletions

View File

@ -30,13 +30,13 @@ var Keys schema.ProgramConfig = schema.ProgramConfig{
"analysis_view_histogramMetrics": []string{"flops_any", "mem_bw", "mem_used"}, "analysis_view_histogramMetrics": []string{"flops_any", "mem_bw", "mem_used"},
"analysis_view_scatterPlotMetrics": [][]string{{"flops_any", "mem_bw"}, {"flops_any", "cpu_load"}, {"cpu_load", "mem_bw"}}, "analysis_view_scatterPlotMetrics": [][]string{{"flops_any", "mem_bw"}, {"flops_any", "cpu_load"}, {"cpu_load", "mem_bw"}},
"job_view_nodestats_selectedMetrics": []string{"flops_any", "mem_bw", "mem_used"}, "job_view_nodestats_selectedMetrics": []string{"flops_any", "mem_bw", "mem_used"},
"job_view_polarPlotMetrics": []string{"flops_any", "mem_bw", "mem_used", "net_bw", "file_bw"}, "job_view_polarPlotMetrics": []string{"flops_any", "mem_bw", "mem_used"},
"job_view_selectedMetrics": []string{"flops_any", "mem_bw", "mem_used"}, "job_view_selectedMetrics": []string{"flops_any", "mem_bw", "mem_used"},
"plot_general_colorBackground": true, "plot_general_colorBackground": true,
"plot_general_colorscheme": []string{"#00bfff", "#0000ff", "#ff00ff", "#ff0000", "#ff8000", "#ffff00", "#80ff00"}, "plot_general_colorscheme": []string{"#00bfff", "#0000ff", "#ff00ff", "#ff0000", "#ff8000", "#ffff00", "#80ff00"},
"plot_general_lineWidth": 3, "plot_general_lineWidth": 3,
"plot_list_jobsPerPage": 50, "plot_list_jobsPerPage": 50,
"plot_list_selectedMetrics": []string{"cpu_load", "ipc", "mem_used", "flops_any", "mem_bw"}, "plot_list_selectedMetrics": []string{"cpu_load", "mem_used", "flops_any", "mem_bw"},
"plot_view_plotsPerRow": 3, "plot_view_plotsPerRow": 3,
"plot_view_showPolarplot": true, "plot_view_showPolarplot": true,
"plot_view_showRoofline": true, "plot_view_showRoofline": true,

View File

@ -87,10 +87,13 @@ func HandleImportFlag(flag string) error {
} }
// TODO: Other metrics... // TODO: Other metrics...
job.LoadAvg = loadJobStat(&jobMeta, "cpu_load")
job.FlopsAnyAvg = loadJobStat(&jobMeta, "flops_any") job.FlopsAnyAvg = loadJobStat(&jobMeta, "flops_any")
job.MemUsedMax = loadJobStat(&jobMeta, "mem_used")
job.MemBwAvg = loadJobStat(&jobMeta, "mem_bw") job.MemBwAvg = loadJobStat(&jobMeta, "mem_bw")
job.NetBwAvg = loadJobStat(&jobMeta, "net_bw") job.NetBwAvg = loadJobStat(&jobMeta, "net_bw")
job.FileBwAvg = loadJobStat(&jobMeta, "file_bw") job.FileBwAvg = loadJobStat(&jobMeta, "file_bw")
job.RawResources, err = json.Marshal(job.Resources) job.RawResources, err = json.Marshal(job.Resources)
if err != nil { if err != nil {
log.Warn("Error while marshaling job resources") log.Warn("Error while marshaling job resources")

View File

@ -61,7 +61,9 @@ func InitDB() error {
} }
// TODO: Other metrics... // TODO: Other metrics...
job.LoadAvg = loadJobStat(jobMeta, "cpu_load")
job.FlopsAnyAvg = loadJobStat(jobMeta, "flops_any") job.FlopsAnyAvg = loadJobStat(jobMeta, "flops_any")
job.MemUsedMax = loadJobStat(jobMeta, "mem_used")
job.MemBwAvg = loadJobStat(jobMeta, "mem_bw") job.MemBwAvg = loadJobStat(jobMeta, "mem_bw")
job.NetBwAvg = loadJobStat(jobMeta, "net_bw") job.NetBwAvg = loadJobStat(jobMeta, "net_bw")
job.FileBwAvg = loadJobStat(jobMeta, "file_bw") job.FileBwAvg = loadJobStat(jobMeta, "file_bw")
@ -150,8 +152,12 @@ func SanityChecks(job *schema.BaseJob) error {
func loadJobStat(job *schema.JobMeta, metric string) float64 { func loadJobStat(job *schema.JobMeta, metric string) float64 {
if stats, ok := job.Statistics[metric]; ok { if stats, ok := job.Statistics[metric]; ok {
if metric == "mem_used" {
return stats.Max
} else {
return stats.Avg return stats.Avg
} }
}
return 0.0 return 0.0
} }

View File

@ -450,6 +450,7 @@ func (r *JobRepository) MarkArchived(
case "mem_bw": case "mem_bw":
stmt = stmt.Set("mem_bw_avg", stats.Avg) stmt = stmt.Set("mem_bw_avg", stats.Avg)
case "load": case "load":
case "cpu_load":
stmt = stmt.Set("load_avg", stats.Avg) stmt = stmt.Set("load_avg", stats.Avg)
case "net_bw": case "net_bw":
stmt = stmt.Set("net_bw_avg", stats.Avg) stmt = stmt.Set("net_bw_avg", stats.Avg)

View File

@ -63,7 +63,7 @@ func TestGetUIConfig(t *testing.T) {
tmp := cfg["plot_list_selectedMetrics"] tmp := cfg["plot_list_selectedMetrics"]
metrics := tmp.([]string) metrics := tmp.([]string)
str := metrics[2] str := metrics[2]
if str != "mem_used" { if str != "flops_any" {
t.Errorf("wrong config\ngot: %s \nwant: mem_bw", str) t.Errorf("wrong config\ngot: %s \nwant: flops_any", str)
} }
} }

View File

@ -480,6 +480,7 @@
}, },
"required": [ "required": [
"cpu_user", "cpu_user",
"cpu_load",
"mem_used", "mem_used",
"flops_any", "flops_any",
"mem_bw", "mem_bw",

View File

@ -327,6 +327,7 @@
}, },
"required": [ "required": [
"cpu_user", "cpu_user",
"cpu_load",
"mem_used", "mem_used",
"flops_any", "flops_any",
"mem_bw" "mem_bw"