Skip to content

Commit

Permalink
Use more appropriate name than cgroup
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed May 29, 2018
1 parent 45e3c9b commit c8b7487
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions client/driver/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,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.
Expand Down Expand Up @@ -492,7 +492,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",
Expand All @@ -503,7 +503,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)
}
Expand Down
6 changes: 3 additions & 3 deletions client/driver/executor/executor_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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
}

Expand Down Expand Up @@ -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 {
Expand Down
10 changes: 5 additions & 5 deletions client/driver/raw_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c8b7487

Please sign in to comment.