Files
nomad/drivers/shared/executor/procstats/list_linux.go
Seth Hoenig a4cc76bd3e numa: enable numa topology detection (#18146)
* client: refactor cgroups management in client

* client: fingerprint numa topology

* client: plumb numa and cgroups changes to drivers

* client: cleanup task resource accounting

* client: numa client and config plumbing

* lib: add a stack implementation

* tools: remove ec2info tool

* plugins: fixup testing for cgroups / numa changes

* build: update makefile and package tests and cl
2023-08-10 17:05:30 -05:00

33 lines
586 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
//go:build linux
package procstats
import (
"github.com/hashicorp/go-set"
"github.com/hashicorp/nomad/client/lib/cgroupslib"
)
type Cgrouper interface {
Cgroup() string
}
func List(cg Cgrouper) *set.Set[ProcessID] {
cgroup := cg.Cgroup()
var ed cgroupslib.Interface
switch cgroupslib.GetMode() {
case cgroupslib.CG1:
ed = cgroupslib.OpenFromCpusetCG1(cgroup, "freezer")
default:
ed = cgroupslib.OpenPath(cgroup)
}
s, err := ed.PIDs()
if err != nil {
return set.New[ProcessID](0)
}
return s
}