Upgrade cc-units

This commit is contained in:
Jan Eitzinger 2023-05-04 17:20:33 +02:00
parent 066c4553b4
commit 50cf2f57d1
3 changed files with 24 additions and 21 deletions

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.18
require ( require (
github.com/99designs/gqlgen v0.17.24 github.com/99designs/gqlgen v0.17.24
github.com/ClusterCockpit/cc-units v0.3.0 github.com/ClusterCockpit/cc-units v0.4.0
github.com/Masterminds/squirrel v1.5.3 github.com/Masterminds/squirrel v1.5.3
github.com/go-ldap/ldap/v3 v3.4.4 github.com/go-ldap/ldap/v3 v3.4.4
github.com/go-sql-driver/mysql v1.7.0 github.com/go-sql-driver/mysql v1.7.0

2
go.sum
View File

@ -83,6 +83,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI= github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
github.com/ClusterCockpit/cc-units v0.3.0 h1:JEKgEyvN4GABheKIReW2siDXgpYf2zf4STXV2ip418Y= github.com/ClusterCockpit/cc-units v0.3.0 h1:JEKgEyvN4GABheKIReW2siDXgpYf2zf4STXV2ip418Y=
github.com/ClusterCockpit/cc-units v0.3.0/go.mod h1:3S3PAhAayS3pbgcT4q9Vn9VJw22Op51X0YimtG77zBw= github.com/ClusterCockpit/cc-units v0.3.0/go.mod h1:3S3PAhAayS3pbgcT4q9Vn9VJw22Op51X0YimtG77zBw=
github.com/ClusterCockpit/cc-units v0.4.0 h1:zP5DOu99GmErW0tCDf0gcLrlWt42RQ9dpoONEOh4cI0=
github.com/ClusterCockpit/cc-units v0.4.0/go.mod h1:3S3PAhAayS3pbgcT4q9Vn9VJw22Op51X0YimtG77zBw=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/Masterminds/squirrel v1.5.3 h1:YPpoceAcxuzIljlr5iWpNKaql7hLeG1KLSrhvdHpkZc= github.com/Masterminds/squirrel v1.5.3 h1:YPpoceAcxuzIljlr5iWpNKaql7hLeG1KLSrhvdHpkZc=

View File

@ -17,6 +17,7 @@ import (
"github.com/ClusterCockpit/cc-backend/internal/config" "github.com/ClusterCockpit/cc-backend/internal/config"
"github.com/ClusterCockpit/cc-backend/pkg/log" "github.com/ClusterCockpit/cc-backend/pkg/log"
"github.com/ClusterCockpit/cc-backend/pkg/schema" "github.com/ClusterCockpit/cc-backend/pkg/schema"
ccunits "github.com/ClusterCockpit/cc-units"
) )
const Version = 1 const Version = 1
@ -37,26 +38,26 @@ func loadJobData(filename string) (*JobData, error) {
func ConvertUnitString(us string) schema.Unit { func ConvertUnitString(us string) schema.Unit {
var nu schema.Unit var nu schema.Unit
// if us == "CPI" || if us == "CPI" ||
// us == "IPC" || us == "IPC" ||
// us == "load" || us == "load" ||
// us == "" { us == "" {
// nu.Base = us nu.Base = us
// return nu return nu
// } }
// u := ccunits.NewUnit(us) u := ccunits.NewUnit(us)
// p := u.getPrefix() p := u.GetPrefix()
// if p.Prefix() != "" { if p.Prefix() != "" {
// prefix := p.Prefix() prefix := p.Prefix()
// nu.Prefix = &prefix nu.Prefix = prefix
// } }
// m := u.getMeasure() m := u.GetMeasure()
// d := u.getUnitDenominator() d := u.GetUnitDenominator()
// if d.Short() != "inval" { if d.Short() != "inval" {
// nu.Base = fmt.Sprintf("%s/%s", m.Short(), d.Short()) nu.Base = fmt.Sprintf("%s/%s", m.Short(), d.Short())
// } else { } else {
// nu.Base = m.Short() nu.Base = m.Short()
// } }
return nu return nu
} }