changing the formula to correctly pass the CPUQota to docker

This commit is contained in:
Jainin Shah
2018-02-27 12:32:23 -08:00
parent 7f1e01d30d
commit a64fd0c47c

View File

@@ -1139,8 +1139,9 @@ func (d *DockerDriver) createContainerConfig(ctx *ExecContext, task *structs.Tas
// Calculate CPU Quota
if driverConfig.CPUHardLimit {
numCores := runtime.NumCPU()
percentTicks := float64(task.Resources.CPU) / float64(d.node.Resources.CPU)
hostConfig.CPUQuota = int64(percentTicks * defaultCFSPeriodUS)
hostConfig.CPUQuota = int64(percentTicks*defaultCFSPeriodUS) * int64(numCores)
}
// Windows does not support MemorySwap/MemorySwappiness #2193