v1.27.0-a #10

Closed
jonathanface wants to merge 473 commits from v1.27.0-a into master
Showing only changes of commit a98e72507e - Show all commits

View File

@ -3,6 +3,7 @@ package resources
import ( import (
"bytes" "bytes"
"context" "context"
"github.com/elastic/go-sysinfo"
"os/exec" "os/exec"
"regexp" "regexp"
"runtime" "runtime"
@ -10,7 +11,6 @@ import (
"time" "time"
logging "github.com/ipfs/go-log/v2" logging "github.com/ipfs/go-log/v2"
"github.com/pbnjay/memory"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
"golang.org/x/xerrors" "golang.org/x/xerrors"
@ -122,9 +122,19 @@ func getResources() (res Resources, err error) {
} }
} }
h, err := sysinfo.Host()
if err != nil {
return Resources{}, err
}
mem, err := h.Memory()
if err != nil {
return Resources{}, err
}
res = Resources{ res = Resources{
Cpu: runtime.NumCPU(), Cpu: runtime.NumCPU(),
Ram: memory.FreeMemory(), Ram: mem.Available,
Gpu: getGPUDevices(), Gpu: getGPUDevices(),
} }