diff --git a/VERSION b/VERSION index 570c796..e946d6b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v1.0.2 +v1.0.3 diff --git a/internal/model/tabs/clustertab/clustertabtable.go b/internal/model/tabs/clustertab/clustertabtable.go index b59284e..5479682 100644 --- a/internal/model/tabs/clustertab/clustertabtable.go +++ b/internal/model/tabs/clustertab/clustertabtable.go @@ -99,7 +99,7 @@ func (siJson *SinfoJSON) FilterSinfoTable(f string, l *log.Logger) (*TableRows, // This is how many GPUs are allocated on the node gpuAlloc := slurm.ParseGRES(*v.GresUsed) - siTabRows = append(siTabRows, table.Row{*v.Name, strings.Join(*v.Partitions, ","), *v.State, strconv.FormatInt(*v.IdleCpus, 10), strconv.Itoa(*v.Cpus), strconv.Itoa(*v.FreeMemory), strconv.Itoa(*v.RealMemory), strconv.Itoa(*gpuAvail), strconv.Itoa(*gpuAlloc), strings.Join(*v.StateFlags, ",")}) + siTabRows = append(siTabRows, table.Row{*v.Name, strings.Join(*v.Partitions, ","), *v.State, strconv.FormatInt(*v.IdleCpus, 10), strconv.Itoa(*v.Cpus), strconv.Itoa(*v.FreeMemory), strconv.Itoa(*v.RealMemory), strconv.Itoa(*gpuAvail - *gpuAlloc), strconv.Itoa(*gpuAvail), strings.Join(*v.StateFlags, ",")}) siJsonFiltered.Nodes = append(siJsonFiltered.Nodes, v) } } diff --git a/internal/slurm/sinfo.go b/internal/slurm/sinfo.go index 7edca36..b7138e0 100644 --- a/internal/slurm/sinfo.go +++ b/internal/slurm/sinfo.go @@ -12,7 +12,7 @@ type SinfoJSON struct { Nodes []openapi.V0039Node } -var gpuGresPattern = regexp.MustCompile(`^gpu\:([^\:]+)\:?(\d+)?`) +var gpuGresPattern = regexp.MustCompile(`gpu:(.*:)?(\d+)\(.*`) func ParseGRES(line string) *int { value := 0 @@ -25,11 +25,7 @@ func ParseGRES(line string) *int { matches := gpuGresPattern.FindStringSubmatch(g) if len(matches) == 3 { - if matches[2] != "" { - value, _ = strconv.Atoi(matches[2]) - } else { - value, _ = strconv.Atoi(matches[1]) - } + value, _ = strconv.Atoi(matches[2]) } }