Skip to content

Commit 1508f06

Browse files
author
Joeri Hermans
committed
Update GPUs exporter
1 parent 5950bfe commit 1508f06

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

gpus.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"io/ioutil"
2121
"log"
2222
"os/exec"
23+
"strings"
2324
)
2425

2526
type GPUsMetrics struct {
@@ -48,8 +49,14 @@ func ParseOtherGPUs() float64 {
4849
func ParseTotalGPUs() float64 {
4950
args := []string{"-h", "-o \"%n %G\""}
5051
output := string(Execute("sinfo", args))
52+
if len(output) > 0 {
53+
for _, line := range strings.Split(output, "\n") {
54+
descriptor := strings.Split(line, " ")[0]
55+
log.Fatal(descriptor)
56+
}
57+
}
5158

52-
return 10.0 // TODO Implement
59+
return 0.0
5360
}
5461

5562
func ParseGPUsMetrics() *GPUsMetrics {

0 commit comments

Comments
 (0)