Use more appropriate name than cgroup
This commit is contained in:
parent
37e900b1d3
commit
ff28b04c46
|
@ -122,7 +122,7 @@ type ExecCommand struct {
|
|||
// Cgroup marks whether we put the process in a cgroup. Setting this field
|
||||
// doesn't enforce resource limits. To enforce limits, set ResoruceLimits.
|
||||
// Using the cgroup does allow more precise cleanup of processes.
|
||||
Cgroup bool
|
||||
BasicProcessCgroup bool
|
||||
}
|
||||
|
||||
// ProcessState holds information about the state of a user process.
|
||||
|
@ -502,7 +502,7 @@ func (e *UniversalExecutor) Exit() error {
|
|||
}
|
||||
|
||||
// Prefer killing the process via the resource container.
|
||||
if e.cmd.Process != nil && !(e.command.ResourceLimits || e.command.Cgroup) {
|
||||
if e.cmd.Process != nil && !(e.command.ResourceLimits || e.command.BasicProcessCgroup) {
|
||||
proc, err := os.FindProcess(e.cmd.Process.Pid)
|
||||
if err != nil {
|
||||
e.logger.Printf("[ERR] executor: can't find process with pid: %v, err: %v",
|
||||
|
@ -513,7 +513,7 @@ func (e *UniversalExecutor) Exit() error {
|
|||
}
|
||||
}
|
||||
|
||||
if e.command.ResourceLimits || e.command.Cgroup {
|
||||
if e.command.ResourceLimits || e.command.BasicProcessCgroup {
|
||||
if err := e.resConCtx.executorCleanup(); err != nil {
|
||||
merr.Errors = append(merr.Errors, err)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func (e *UniversalExecutor) configureIsolation() error {
|
|||
}
|
||||
}
|
||||
|
||||
if e.command.ResourceLimits || e.command.Cgroup {
|
||||
if e.command.ResourceLimits || e.command.BasicProcessCgroup {
|
||||
if err := e.configureCgroups(e.ctx.Task.Resources); err != nil {
|
||||
return fmt.Errorf("error creating cgroups: %v", err)
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ func (e *UniversalExecutor) configureIsolation() error {
|
|||
|
||||
// applyLimits puts a process in a pre-configured cgroup
|
||||
func (e *UniversalExecutor) applyLimits(pid int) error {
|
||||
if !(e.command.ResourceLimits || e.command.Cgroup) {
|
||||
if !(e.command.ResourceLimits || e.command.BasicProcessCgroup) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ func (e *UniversalExecutor) configureChroot() error {
|
|||
// isolation and we scan the entire process table if the user is not using any
|
||||
// isolation
|
||||
func (e *UniversalExecutor) getAllPids() (map[int]*nomadPid, error) {
|
||||
if e.command.ResourceLimits || e.command.Cgroup {
|
||||
if e.command.ResourceLimits || e.command.BasicProcessCgroup {
|
||||
manager := getCgroupManager(e.resConCtx.groups, e.resConCtx.cgPaths)
|
||||
pids, err := manager.GetAllPids()
|
||||
if err != nil {
|
||||
|
|
|
@ -169,11 +169,11 @@ func (d *RawExecDriver) Start(ctx *ExecContext, task *structs.Task) (*StartRespo
|
|||
}
|
||||
|
||||
execCmd := &executor.ExecCommand{
|
||||
Cmd: command,
|
||||
Args: driverConfig.Args,
|
||||
User: task.User,
|
||||
TaskKillSignal: taskKillSignal,
|
||||
Cgroup: d.useCgroup,
|
||||
Cmd: command,
|
||||
Args: driverConfig.Args,
|
||||
User: task.User,
|
||||
TaskKillSignal: taskKillSignal,
|
||||
BasicProcessCgroup: d.useCgroup,
|
||||
}
|
||||
ps, err := exec.LaunchCmd(execCmd)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue