This commit is contained in:
Alex Dadgar 2018-12-18 15:10:13 -08:00
parent 66cf3156b2
commit b8268d9a46
2 changed files with 3 additions and 3 deletions

View File

@ -706,8 +706,8 @@ func (tr *TaskRunner) buildTaskConfig() *drivers.TaskConfig {
Resources: &drivers.Resources{
NomadResources: taskResources,
LinuxResources: &drivers.LinuxResources{
MemoryLimitBytes: int64(taskResources.Memory.MemoryMB) * 1024 * 1024,
CPUShares: int64(taskResources.Cpu.CpuShares),
MemoryLimitBytes: taskResources.Memory.MemoryMB * 1024 * 1024,
CPUShares: taskResources.Cpu.CpuShares,
PercentTicks: float64(taskResources.Cpu.CpuShares) / float64(tr.clientConfig.Node.NodeResources.Cpu.CpuShares),
},
},

View File

@ -580,7 +580,7 @@ func configureCgroups(cfg *lconfigs.Config, command *ExecCommand) error {
if mb := command.Resources.NomadResources.Memory.MemoryMB; mb > 0 {
// Total amount of memory allowed to consume
cfg.Cgroups.Resources.Memory = int64(mb * 1024 * 1024)
cfg.Cgroups.Resources.Memory = mb * 1024 * 1024
// Disable swap to avoid issues on the machine
var memSwappiness uint64
cfg.Cgroups.Resources.MemorySwappiness = &memSwappiness