Debug migration routine

This commit is contained in:
Jan Eitzinger 2023-03-23 10:29:11 +01:00
parent cf6c217f76
commit 20290f296d
2 changed files with 14 additions and 11 deletions

View File

@ -657,7 +657,7 @@ func testImportFlag(t *testing.T) {
for name, scopes := range data { for name, scopes := range data {
for _, metric := range scopes { for _, metric := range scopes {
if metric.Unit.Base != r[name] { if metric.Unit.Base != r[name] {
t.Errorf("Metric %s unit: Got %s, want %s", name, metric.Unit, r[name]) t.Errorf("Metric %s unit: Got %s, want %s", name, metric.Unit.Base, r[name])
} }
} }
} }

View File

@ -72,25 +72,28 @@ func deepCopyJobMeta(j *JobMeta) schema.JobMeta {
} }
func deepCopyJobData(d *JobData) schema.JobData { func deepCopyJobData(d *JobData) schema.JobData {
var dn schema.JobData = make(schema.JobData) var dn = make(schema.JobData)
for k, v := range *d { for k, v := range *d {
for mk, mv := range v { for mk, mv := range v {
var mn schema.JobMetric var mn schema.JobMetric
mn.Unit = units.ConvertUnitString(mv.Unit) mn.Unit = units.ConvertUnitString(mv.Unit)
mn.Timestep = mv.Timestep mn.Timestep = mv.Timestep
mn.Series = make([]schema.Series, len(mv.Series))
for _, v := range mv.Series { for _, v := range mv.Series {
var id *string = new(string)
var sn schema.Series var sn schema.Series
sn.Hostname = v.Hostname sn.Hostname = v.Hostname
if v.Id != nil {
var id = new(string)
*id = fmt.Sprint(*v.Id) *id = fmt.Sprint(*v.Id)
sn.Id = id sn.Id = id
}
if v.Statistics != nil {
sn.Statistics = schema.MetricStatistics{ sn.Statistics = schema.MetricStatistics{
Avg: v.Statistics.Avg, Avg: v.Statistics.Avg,
Min: v.Statistics.Min, Min: v.Statistics.Min,
Max: v.Statistics.Max} Max: v.Statistics.Max}
}
sn.Data = make([]schema.Float, len(v.Data)) sn.Data = make([]schema.Float, len(v.Data))
copy(sn.Data, v.Data) copy(sn.Data, v.Data)
@ -121,7 +124,7 @@ func deepCopyClusterConfig(co *Cluster) schema.Cluster {
scn.SocketsPerNode = sco.SocketsPerNode scn.SocketsPerNode = sco.SocketsPerNode
scn.CoresPerSocket = sco.CoresPerSocket scn.CoresPerSocket = sco.CoresPerSocket
scn.ThreadsPerCore = sco.ThreadsPerCore scn.ThreadsPerCore = sco.ThreadsPerCore
var prefix *string = new(string) var prefix = new(string)
*prefix = "G" *prefix = "G"
scn.FlopRateScalar = schema.MetricValue{ scn.FlopRateScalar = schema.MetricValue{
Unit: schema.Unit{Base: "F/s", Prefix: prefix}, Unit: schema.Unit{Base: "F/s", Prefix: prefix},