Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.0.2
v1.0.3
2 changes: 1 addition & 1 deletion internal/model/tabs/clustertab/clustertabtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
8 changes: 2 additions & 6 deletions internal/slurm/sinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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])
}
}

Expand Down