Skip to content

Commit

Permalink
CORE-9295, TG-16, cyverse-archive/de-gxt-ui#339: Ensure that max cpu …
Browse files Browse the repository at this point in the history
…cores are passed down in the docker-compose file
  • Loading branch information
ianmcorvidae committed Oct 3, 2018
1 parent 6a0b700 commit 3f2342d
Show file tree
Hide file tree
Showing 37 changed files with 1,375 additions and 141 deletions.
17 changes: 12 additions & 5 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
version = "1.0.0"

[[constraint]]
name = "gopkg.in/cyverse-de/messaging.v4"
version = "4.0.0"
name = "gopkg.in/cyverse-de/messaging.v6"
version = "6.0.0"

[[constraint]]
name = "gopkg.in/cyverse-de/model.v2"
version = "2.11.0"
name = "gopkg.in/cyverse-de/model.v4"
version = "4.1.0"

[[constraint]]
branch = "v2"
Expand Down
11 changes: 7 additions & 4 deletions dcompose/dcompose.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/pkg/errors"
"github.com/spf13/viper"
"gopkg.in/cyverse-de/model.v2"
"gopkg.in/cyverse-de/model.v4"
)

// WORKDIR is the path to the working directory inside all of the containers
Expand Down Expand Up @@ -83,6 +83,7 @@ type Service struct {
CapDrop []string `yaml:"cap_drop,flow"`
Command []string `yaml:",omitempty"`
ContainerName string `yaml:"container_name,omitempty"`
CPUs string `yaml:"cpus,omitempty"`
CPUSet string `yaml:"cpuset,omitempty"`
CPUShares int64 `yaml:"cpu_shares,omitempty"`
CPUQuota string `yaml:"cpu_quota,omitempty"`
Expand Down Expand Up @@ -132,7 +133,7 @@ func New(ld string, pathprefix string) (*JobCompose, error) {
}

return &JobCompose{
Version: "2.1",
Version: "2.2",
Volumes: make(map[string]*Volume),
Networks: make(map[string]*Network),
Services: make(map[string]*Service),
Expand Down Expand Up @@ -200,7 +201,7 @@ func (j *JobCompose) InitFromJob(job *model.Job, cfg *viper.Viper, workingdir st
strings.Join([]string{excludesPath, excludesMount, "ro"}, ":"),
)

j.Services["upload_outputs"] = uploadOutputsSvc;
j.Services["upload_outputs"] = uploadOutputsSvc
}

func NewPorklockService(containertype int, invocationID, workingVolumeHostPath, porklockImageName string, porklockCommand []string) *Service {
Expand Down Expand Up @@ -311,7 +312,9 @@ func (j *JobCompose) ConvertStep(step *model.Step, index int, user, invID, worki
svc.MemLimit = strconv.FormatInt(stepContainer.MemoryLimit, 10)
}

if stepContainer.CPUShares > 0 {
if stepContainer.MaxCPUCores > 0.0 {
svc.CPUs = fmt.Sprintf("%f", stepContainer.MaxCPUCores)
} else if stepContainer.CPUShares > 0 {
svc.CPUShares = stepContainer.CPUShares
}

Expand Down
11 changes: 6 additions & 5 deletions dcompose/dcompose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"reflect"
"testing"

"gopkg.in/cyverse-de/model.v2"
"gopkg.in/cyverse-de/model.v4"

yaml "gopkg.in/yaml.v2"
)
Expand Down Expand Up @@ -62,10 +62,11 @@ var testJob = &model.Job{
},
Component: model.StepComponent{
Container: model.Container{
ID: "container-id-1",
Name: "container-name-1",
CPUShares: 0,
PIDsLimit: 64,
ID: "container-id-1",
Name: "container-name-1",
CPUShares: 0,
MaxCPUCores: 2,
PIDsLimit: 64,
Image: model.ContainerImage{
ID: "container-image-1",
Name: "container-image-name-1",
Expand Down
2 changes: 1 addition & 1 deletion exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"

"github.com/spf13/viper"
"gopkg.in/cyverse-de/messaging.v4"
"gopkg.in/cyverse-de/messaging.v6"
)

func cleanup(cfg *viper.Viper) {
Expand Down
2 changes: 1 addition & 1 deletion fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"path"

"github.com/pkg/errors"
"gopkg.in/cyverse-de/model.v2"
"gopkg.in/cyverse-de/model.v4"
)

// adapted from https://talks.golang.org/2012/10things.slide#8
Expand Down
2 changes: 1 addition & 1 deletion fs/fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"reflect"
"testing"

"gopkg.in/cyverse-de/model.v2"
"gopkg.in/cyverse-de/model.v4"
)

type testFS struct {
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
"github.com/streadway/amqp"
"gopkg.in/cyverse-de/messaging.v4"
"gopkg.in/cyverse-de/model.v2"
"gopkg.in/cyverse-de/messaging.v6"
"gopkg.in/cyverse-de/model.v4"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions run.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
"gopkg.in/cyverse-de/messaging.v4"
"gopkg.in/cyverse-de/model.v2"
"gopkg.in/cyverse-de/messaging.v6"
"gopkg.in/cyverse-de/model.v4"
)

// logrusProxyWriter will prevent
Expand Down
4 changes: 2 additions & 2 deletions status.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"os"

"gopkg.in/cyverse-de/messaging.v4"
"gopkg.in/cyverse-de/model.v2"
"gopkg.in/cyverse-de/messaging.v6"
"gopkg.in/cyverse-de/model.v4"
)

func hostname() string {
Expand Down
4 changes: 2 additions & 2 deletions status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"errors"
"testing"

"gopkg.in/cyverse-de/messaging.v4"
"gopkg.in/cyverse-de/model.v2"
"gopkg.in/cyverse-de/messaging.v6"
"gopkg.in/cyverse-de/model.v4"
)

type TestJobUpdatePublisher struct {
Expand Down
6 changes: 2 additions & 4 deletions vendor/github.com/streadway/amqp/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions vendor/github.com/streadway/amqp/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3f2342d

Please sign in to comment.