Set instance count to 20 to allow scheduling of SLA aware jobs

Addtional changes include update settings to `10` instances and increasing
`go test` _timeout_ to `15m`.
This commit is contained in:
Robert Allen 2018-12-20 11:20:29 -06:00
parent 9ed7690de1
commit 01fec6e124
5 changed files with 86 additions and 17 deletions

View file

@ -25,7 +25,7 @@ install:
- docker-compose up -d
script:
- go test -race -coverprofile=coverage.txt -covermode=atomic -v github.com/paypal/gorealis
- go test -race -coverprofile=coverage.txt -covermode=atomic -v github.com/paypal/gorealis -timeout 15m
after_success:
- bash <(curl -s https://codecov.io/bash)

View file

@ -55,6 +55,74 @@ services:
depends_on:
- zk
agent-two:
image: rdelvalle/mesos-agent:1.5.1
pid: host
restart: on-failure
environment:
MESOS_MASTER: zk://192.168.33.2:2181/mesos
MESOS_CONTAINERIZERS: docker,mesos
MESOS_PORT: 5051
MESOS_HOSTNAME: localhost
MESOS_RESOURCES: ports(*):[11000-11999]
MESOS_SYSTEMD_ENABLE_SUPPORT: 'false'
MESOS_WORK_DIR: /tmp/mesos
networks:
aurora_cluster:
ipv4_address: 192.168.33.5
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- zk
agent-three:
image: rdelvalle/mesos-agent:1.5.1
pid: host
restart: on-failure
environment:
MESOS_MASTER: zk://192.168.33.2:2181/mesos
MESOS_CONTAINERIZERS: docker,mesos
MESOS_PORT: 5051
MESOS_HOSTNAME: localhost
MESOS_RESOURCES: ports(*):[11000-11999]
MESOS_SYSTEMD_ENABLE_SUPPORT: 'false'
MESOS_WORK_DIR: /tmp/mesos
networks:
aurora_cluster:
ipv4_address: 192.168.33.16
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- zk
agent-four:
image: rdelvalle/mesos-agent:1.5.1
pid: host
restart: on-failure
environment:
MESOS_MASTER: zk://192.168.33.2:2181/mesos
MESOS_CONTAINERIZERS: docker,mesos
MESOS_PORT: 5051
MESOS_HOSTNAME: localhost
MESOS_RESOURCES: ports(*):[11000-11999]
MESOS_SYSTEMD_ENABLE_SUPPORT: 'false'
MESOS_WORK_DIR: /tmp/mesos
networks:
aurora_cluster:
ipv4_address: 192.168.33.15
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- zk
aurora-one:
image: rdelvalle/aurora:0.21.0
pid: host

6
job.go
View file

@ -56,7 +56,7 @@ type Job interface {
MaxFailure(maxFail int32) Job
Container(container Container) Job
PartitionPolicy(policy *aurora.PartitionPolicy) Job
Tier(tier *string) Job
Tier(tier string) Job
SlaPolicy(policy *aurora.SlaPolicy) Job
}
@ -326,8 +326,8 @@ func (j *AuroraJob) PartitionPolicy(policy *aurora.PartitionPolicy) Job {
}
// Set the Tier for the Job.
func (j *AuroraJob) Tier(tier *string) Job {
j.jobConfig.TaskConfig.Tier = tier
func (j *AuroraJob) Tier(tier string) Job {
j.jobConfig.TaskConfig.Tier = &tier
return j
}

View file

@ -393,6 +393,7 @@ func TestRealisClient_CreateService(t *testing.T) {
settings := realis.NewUpdateSettings()
settings.UpdateGroupSize = 2
settings.MinWaitInInstanceRunningMs = 10 * 1000
job.InstanceCount(3)
resp, result, err := r.CreateService(job, settings)
@ -403,7 +404,7 @@ func TestRealisClient_CreateService(t *testing.T) {
var ok bool
var mErr error
if ok, mErr = monitor.JobUpdate(*result.GetKey(), 5, 180); !ok || mErr != nil {
if ok, mErr = monitor.JobUpdate(*result.GetKey(), 5, 240); !ok || mErr != nil {
// Update may already be in a terminal state so don't check for error
_, err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out.")
@ -753,7 +754,6 @@ func TestAuroraJob_SlaPolicy(t *testing.T) {
},
}
role := "vagrant"
tier := "preferred"
var cpu float64 = 6.0
var disk int64 = 256
@ -774,15 +774,16 @@ func TestAuroraJob_SlaPolicy(t *testing.T) {
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
ExecutorData(string(thermosPayload)).
CPU(.1).
RAM(4).
Disk(10).
InstanceCount(3).
RAM(2).
Disk(5).
InstanceCount(20).
IsService(true).
SlaPolicy(&tt.args).
Tier(&tier)
Tier("preferred")
settings := realis.NewUpdateSettings()
settings.UpdateGroupSize = 1
settings.UpdateGroupSize = 10
settings.MinWaitInInstanceRunningMs = 15 * 1000
resp, result, err := r.CreateService(job, settings)
assert.NoError(t, err)
@ -807,12 +808,12 @@ func TestAuroraJob_SlaPolicy(t *testing.T) {
_, err = r.KillJob(job.JobKey())
assert.NoError(t, err)
cpu = 0
ram = 0
disk = 0
r.SetQuota(role, &cpu, &ram, &disk)
})
cpu = 0
ram = 0
disk = 0
r.SetQuota(role, &cpu, &ram, &disk)
}
}

View file

@ -1,4 +1,4 @@
#!/bin/bash
# Since we run our docker compose setup in bridge mode to be able to run on MacOS, we have to launch a Docker container within the bridge network in order to avoid any routing issues.
docker run -t -v $(pwd):/go/src/github.com/paypal/gorealis --network gorealis_aurora_cluster golang:1.10.3-stretch go test -v github.com/paypal/gorealis
docker run -t -v $(pwd):/go/src/github.com/paypal/gorealis --network gorealis_aurora_cluster golang:1.10.3-stretch go test -v github.com/paypal/gorealis -timeout 15m