Skip to content

Commit

Permalink
Update GPUs exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
Joeri Hermans committed Oct 15, 2020
1 parent 5950bfe commit 1508f06
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gpus.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"io/ioutil"
"log"
"os/exec"
"strings"
)

type GPUsMetrics struct {
Expand Down Expand Up @@ -48,8 +49,14 @@ func ParseOtherGPUs() float64 {
func ParseTotalGPUs() float64 {
args := []string{"-h", "-o \"%n %G\""}
output := string(Execute("sinfo", args))
if len(output) > 0 {
for _, line := range strings.Split(output, "\n") {
descriptor := strings.Split(line, " ")[0]
log.Fatal(descriptor)
}
}

return 10.0 // TODO Implement
return 0.0
}

func ParseGPUsMetrics() *GPUsMetrics {
Expand Down

0 comments on commit 1508f06

Please sign in to comment.