diff --git a/client/driver/executor/executor.go b/client/driver/executor/executor.go index 77a472c1c..8db847ad5 100644 --- a/client/driver/executor/executor.go +++ b/client/driver/executor/executor.go @@ -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) } diff --git a/client/driver/executor/executor_linux.go b/client/driver/executor/executor_linux.go index 7da9c3d16..da7e7a239 100644 --- a/client/driver/executor/executor_linux.go +++ b/client/driver/executor/executor_linux.go @@ -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 { diff --git a/client/driver/raw_exec.go b/client/driver/raw_exec.go index a4314e9c3..e57366e64 100644 --- a/client/driver/raw_exec.go +++ b/client/driver/raw_exec.go @@ -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 {