Add support for defining specific threads for containers

This commit is contained in:
Dane Everitt
2020-03-29 12:31:17 -07:00
parent f0e37f1e98
commit ddca34f9e8
3 changed files with 6 additions and 2 deletions

View File

@@ -817,5 +817,6 @@ func (d *DockerEnvironment) getResourcesForServer() container.Resources {
CPUShares: 1024,
BlkioWeight: d.Server.Build.IoWeight,
OomKillDisable: &d.Server.Container.OomDisabled,
CpusetCpus: d.Server.Build.Threads,
}
}

View File

@@ -98,6 +98,9 @@ type BuildSettings struct {
// The amount of disk space in megabytes that a server is allowed to use.
DiskSpace int64 `json:"disk_space" yaml:"disk"`
// Sets which CPU threads can be used by the docker instance.
Threads string `json:"threads" yaml:"threads"`
}
// Converts the CPU limit for a server build into a number that can be better understood
@@ -294,7 +297,7 @@ func (s *Server) Sync() error {
}
// Update the data structure and persist it to the disk.
if err:= s.UpdateDataStructure(cfg.Settings, false); err != nil {
if err := s.UpdateDataStructure(cfg.Settings, false); err != nil {
return errors.WithStack(err)
}