mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-07-22 20:41:40 +02:00
Cleanup
Use external cc-units Lint code Fix import tests
This commit is contained in:
@@ -17,7 +17,6 @@ import (
|
||||
"github.com/ClusterCockpit/cc-backend/internal/config"
|
||||
"github.com/ClusterCockpit/cc-backend/pkg/log"
|
||||
"github.com/ClusterCockpit/cc-backend/pkg/schema"
|
||||
"github.com/ClusterCockpit/cc-backend/pkg/units"
|
||||
)
|
||||
|
||||
const Version = 1
|
||||
@@ -35,6 +34,33 @@ func loadJobData(filename string) (*JobData, error) {
|
||||
return DecodeJobData(bufio.NewReader(f))
|
||||
}
|
||||
|
||||
func ConvertUnitString(us string) schema.Unit {
|
||||
var nu schema.Unit
|
||||
|
||||
// if us == "CPI" ||
|
||||
// us == "IPC" ||
|
||||
// us == "load" ||
|
||||
// us == "" {
|
||||
// nu.Base = us
|
||||
// return nu
|
||||
// }
|
||||
// u := ccunits.NewUnit(us)
|
||||
// p := u.getPrefix()
|
||||
// if p.Prefix() != "" {
|
||||
// prefix := p.Prefix()
|
||||
// nu.Prefix = &prefix
|
||||
// }
|
||||
// m := u.getMeasure()
|
||||
// d := u.getUnitDenominator()
|
||||
// if d.Short() != "inval" {
|
||||
// nu.Base = fmt.Sprintf("%s/%s", m.Short(), d.Short())
|
||||
// } else {
|
||||
// nu.Base = m.Short()
|
||||
// }
|
||||
|
||||
return nu
|
||||
}
|
||||
|
||||
func deepCopyJobMeta(j *JobMeta) schema.JobMeta {
|
||||
var jn schema.JobMeta
|
||||
|
||||
@@ -78,7 +104,7 @@ func deepCopyJobMeta(j *JobMeta) schema.JobMeta {
|
||||
sn.Avg = v.Avg
|
||||
sn.Max = v.Max
|
||||
sn.Min = v.Min
|
||||
tmpUnit := units.ConvertUnitString(v.Unit)
|
||||
tmpUnit := ConvertUnitString(v.Unit)
|
||||
if tmpUnit.Base == "inval" {
|
||||
sn.Unit = schema.Unit{Base: ""}
|
||||
} else {
|
||||
@@ -113,7 +139,7 @@ func deepCopyJobData(d *JobData, cluster string, subCluster string) *schema.JobD
|
||||
for mk, mv := range v {
|
||||
// fmt.Printf("Scope %s\n", mk)
|
||||
var mn schema.JobMetric
|
||||
tmpUnit := units.ConvertUnitString(mv.Unit)
|
||||
tmpUnit := ConvertUnitString(mv.Unit)
|
||||
if tmpUnit.Base == "inval" {
|
||||
mn.Unit = schema.Unit{Base: ""}
|
||||
} else {
|
||||
@@ -198,7 +224,7 @@ func deepCopyClusterConfig(co *Cluster) schema.Cluster {
|
||||
mcn.Aggregation = mco.Aggregation
|
||||
}
|
||||
mcn.Timestep = mco.Timestep
|
||||
tmpUnit := units.ConvertUnitString(mco.Unit)
|
||||
tmpUnit := ConvertUnitString(mco.Unit)
|
||||
if tmpUnit.Base == "inval" {
|
||||
mcn.Unit = schema.Unit{Base: ""}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user