change deprecated defaultMetrics loader to new confkey

- see PR #333
This commit is contained in:
Christoph Kluge
2025-10-08 18:24:41 +02:00
parent e296cd7ca0
commit 471ec1cd2e
3 changed files with 6 additions and 13 deletions

View File

@@ -1,12 +0,0 @@
{
"clusters": [
{
"name": "fritz",
"default_metrics": "cpu_load, flops_any, core_power, lustre_open, mem_used, mem_bw, net_bytes_in"
},
{
"name": "alex",
"default_metrics": "flops_any, mem_bw, mem_used, vectorization_ratio"
}
]
}

View File

@@ -11,6 +11,8 @@ import (
"strings" "strings"
) )
// DEPRECATED: SUPERSEDED BY NEW USER CONFIG - userConfig.go / web.go
type DefaultMetricsCluster struct { type DefaultMetricsCluster struct {
Name string `json:"name"` Name string `json:"name"`
DefaultMetrics string `json:"default_metrics"` DefaultMetrics string `json:"default_metrics"`

View File

@@ -129,6 +129,7 @@ func (r *UserRepository) AddUser(user *schema.User) error {
cclog.Infof("new user %#v created (roles: %s, auth-source: %d, projects: %s)", user.Username, rolesJson, user.AuthSource, projectsJson) cclog.Infof("new user %#v created (roles: %s, auth-source: %d, projects: %s)", user.Username, rolesJson, user.AuthSource, projectsJson)
// DEPRECATED: SUPERSEDED BY NEW USER CONFIG - userConfig.go / web.go
defaultMetricsCfg, err := config.LoadDefaultMetricsConfig() defaultMetricsCfg, err := config.LoadDefaultMetricsConfig()
if err != nil { if err != nil {
cclog.Errorf("Error loading default metrics config: %v", err) cclog.Errorf("Error loading default metrics config: %v", err)
@@ -140,7 +141,8 @@ func (r *UserRepository) AddUser(user *schema.User) error {
cclog.Errorf("Error marshaling default metrics for cluster %s: %v", cluster.Name, err) cclog.Errorf("Error marshaling default metrics for cluster %s: %v", cluster.Name, err)
continue continue
} }
confKey := "job_view_selectedMetrics:" + cluster.Name // Note: StatisticsTable now has different key (metricConfig_jobViewTableMetrics): Not updated here.
confKey := "metricConfig_jobViewPlotMetrics:" + cluster.Name
if _, err := sq.Insert("configuration"). if _, err := sq.Insert("configuration").
Columns("username", "confkey", "value"). Columns("username", "confkey", "value").
Values(user.Username, confKey, string(metricsJSON)). Values(user.Username, confKey, string(metricsJSON)).
@@ -151,6 +153,7 @@ func (r *UserRepository) AddUser(user *schema.User) error {
} }
} }
} }
// END DEPRECATION
return nil return nil
} }