mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
* 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
29 lines
566 B
Go
29 lines
566 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
//go:build linux
|
|
|
|
package proclib
|
|
|
|
import (
|
|
"github.com/hashicorp/nomad/client/lib/cgroupslib"
|
|
)
|
|
|
|
// New creates a Wranglers factory for creating ProcessWrangler's appropriate
|
|
// for the given system (i.e. cgroups v1 or cgroups v2).
|
|
func New(configs *Configs) *Wranglers {
|
|
w := &Wranglers{
|
|
configs: configs,
|
|
m: make(map[Task]ProcessWrangler),
|
|
}
|
|
|
|
switch cgroupslib.GetMode() {
|
|
case cgroupslib.CG1:
|
|
w.create = newCG1(configs)
|
|
default:
|
|
w.create = newCG2(configs)
|
|
}
|
|
|
|
return w
|
|
}
|