Skip to content

Commit

Permalink
executor_universal_linux getAllPids chooses cgroup when available
Browse files Browse the repository at this point in the history
  • Loading branch information
langmartin committed Jul 17, 2019
1 parent 3834616 commit 1a9c598
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion drivers/shared/executor/executor_universal_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,24 @@ func (e *UniversalExecutor) configureResourceContainer(pid int) error {
},
}

configureBasicCgroups(cfg)
err := configureBasicCgroups(cfg)
if err != nil {
e.logger.Warn("failed to create cgroup", "error", err)
return err
}

e.resConCtx.groups = cfg.Cgroups
return cgroups.EnterPid(cfg.Cgroups.Paths, pid)
}

func (e *UniversalExecutor) getAllPids() (map[int]*nomadPid, error) {
if e.resConCtx.isEmpty() {
return getAllPidsByScanning()
} else {
return e.resConCtx.getAllPidsByCgroup()
}
}

// DestroyCgroup kills all processes in the cgroup and removes the cgroup
// configuration from the host. This function is idempotent.
func DestroyCgroup(groups *lconfigs.Cgroup, executorPid int) error {
Expand Down

0 comments on commit 1a9c598

Please sign in to comment.