Add tier & production in task config (#14)
This commit is contained in:
parent
a75b691d72
commit
fe664178ce
9 changed files with 76 additions and 4 deletions
|
@ -247,6 +247,9 @@ job = realis.NewJob().
|
|||
RAM(64).
|
||||
Disk(100).
|
||||
IsService(false).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0).
|
||||
InstanceCount(1).
|
||||
AddPorts(1).
|
||||
AddLabel("fileName", "sample-app/docker-compose.yml").
|
||||
|
@ -291,6 +294,9 @@ job = realis.NewJob().
|
|||
RAM(64).
|
||||
Disk(100).
|
||||
IsService(true).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0).
|
||||
InstanceCount(1).
|
||||
AddPorts(1)
|
||||
```
|
||||
|
|
|
@ -25,6 +25,9 @@ job = realis.NewJob().
|
|||
RAM(64).
|
||||
Disk(100).
|
||||
IsService(false).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0).
|
||||
InstanceCount(1).
|
||||
AddPorts(1).
|
||||
AddLabel("fileName", "sample-app/docker-compose.yml").
|
||||
|
|
|
@ -124,6 +124,9 @@ func main() {
|
|||
RAM(64).
|
||||
Disk(100).
|
||||
IsService(true).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0).
|
||||
InstanceCount(1).
|
||||
AddPorts(1).
|
||||
ThermosExecutor(thermosExec)
|
||||
|
@ -138,6 +141,9 @@ func main() {
|
|||
RAM(512).
|
||||
Disk(100).
|
||||
IsService(true).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0).
|
||||
InstanceCount(1).
|
||||
AddPorts(4).
|
||||
AddLabel("fileName", "sample-app/docker-compose.yml").
|
||||
|
@ -151,6 +157,9 @@ func main() {
|
|||
RAM(64).
|
||||
Disk(100).
|
||||
IsService(true).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0).
|
||||
InstanceCount(1).
|
||||
AddPorts(1)
|
||||
default:
|
||||
|
|
|
@ -177,6 +177,8 @@ func main() {
|
|||
RAM(job.RAM).
|
||||
Disk(job.Disk).
|
||||
IsService(job.Service).
|
||||
Tier("preemptible").
|
||||
Priority(0).
|
||||
InstanceCount(job.Instances).
|
||||
AddPorts(job.Ports)
|
||||
|
||||
|
|
5
job.go
5
job.go
|
@ -161,6 +161,11 @@ func (j *AuroraJob) Priority(priority int32) *AuroraJob {
|
|||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) Production(production bool) *AuroraJob {
|
||||
j.task.Production(production)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) TaskConfig() *aurora.TaskConfig {
|
||||
return j.task.TaskConfig()
|
||||
}
|
||||
|
|
|
@ -226,6 +226,11 @@ func (j *JobUpdate) Priority(priority int32) *JobUpdate {
|
|||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) Production(production bool) *JobUpdate {
|
||||
j.task.Production(production)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) TaskConfig() *aurora.TaskConfig {
|
||||
return j.task.TaskConfig()
|
||||
}
|
||||
|
|
|
@ -100,6 +100,9 @@ func TestBadCredentials(t *testing.T) {
|
|||
RAM(64).
|
||||
Disk(100).
|
||||
IsService(true).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0).
|
||||
InstanceCount(2).
|
||||
AddPorts(1)
|
||||
|
||||
|
@ -232,6 +235,9 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) {
|
|||
RAM(64).
|
||||
Disk(100).
|
||||
IsService(true).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0).
|
||||
InstanceCount(2).
|
||||
AddPorts(1)
|
||||
|
||||
|
@ -339,6 +345,9 @@ func TestRealisClient_CreateService_WithPulse_Thermos(t *testing.T) {
|
|||
Disk(100).
|
||||
ThermosExecutor(thermosExec).
|
||||
IsService(true).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0).
|
||||
InstanceCount(2).
|
||||
AddPorts(1).
|
||||
AddLabel("currentTime", time.Now().String()).
|
||||
|
@ -424,6 +433,9 @@ func TestRealisClient_CreateService(t *testing.T) {
|
|||
InstanceCount(3).
|
||||
WatchTime(20 * time.Second).
|
||||
IsService(true).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0).
|
||||
BatchSize(2)
|
||||
|
||||
result, err := r.CreateService(job)
|
||||
|
@ -488,6 +500,9 @@ func TestRealisClient_ScheduleCronJob_Thermos(t *testing.T) {
|
|||
RAM(64).
|
||||
Disk(100).
|
||||
IsService(true).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0).
|
||||
InstanceCount(1).
|
||||
AddPorts(1).
|
||||
CronSchedule("* * * * *").
|
||||
|
@ -704,6 +719,9 @@ func TestRealisClient_PartitionPolicy(t *testing.T) {
|
|||
RAM(64).
|
||||
Disk(100).
|
||||
IsService(true).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0).
|
||||
InstanceCount(2).
|
||||
BatchSize(2).
|
||||
PartitionPolicy(true, partitionDelay)
|
||||
|
@ -734,7 +752,10 @@ func TestRealisClient_UpdateStrategies(t *testing.T) {
|
|||
RAM(4).
|
||||
Disk(10).
|
||||
InstanceCount(6).
|
||||
IsService(true)
|
||||
IsService(true).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0)
|
||||
|
||||
// Needed to populate the task config correctly
|
||||
assert.NoError(t, job.BuildThermosPayload())
|
||||
|
@ -798,7 +819,11 @@ func TestRealisClient_BatchAwareAutoPause(t *testing.T) {
|
|||
RAM(4).
|
||||
Disk(10).
|
||||
InstanceCount(6).
|
||||
IsService(true)
|
||||
IsService(true).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0)
|
||||
|
||||
updateGroups := []int32{1, 2, 3}
|
||||
strategy := realis.JobUpdateFromAuroraTask(job.AuroraTask()).
|
||||
VariableBatchStrategy(true, updateGroups...).
|
||||
|
@ -837,8 +862,15 @@ func TestRealisClient_GetJobSummary(t *testing.T) {
|
|||
CPU(.25).
|
||||
RAM(4).
|
||||
Disk(10).
|
||||
InstanceCount(1).
|
||||
IsService(false)
|
||||
InstanceCount(3).
|
||||
WatchTime(20 * time.Second).
|
||||
IsService(true).
|
||||
Production(false).
|
||||
Tier("preemptible").
|
||||
Priority(0).
|
||||
BatchSize(2)
|
||||
|
||||
result, err := r.CreateService(job)
|
||||
|
||||
err := r.CreateJob(job)
|
||||
assert.NoError(t, err)
|
||||
|
|
9
task.go
9
task.go
|
@ -85,6 +85,10 @@ func TaskFromThrift(config *aurora.TaskConfig) *AuroraTask {
|
|||
newTask.Tier(*config.Tier)
|
||||
}
|
||||
|
||||
if config.Production != nil {
|
||||
newTask.Production(*config.Production)
|
||||
}
|
||||
|
||||
if config.ExecutorConfig != nil {
|
||||
newTask.
|
||||
ExecutorName(config.ExecutorConfig.Name).
|
||||
|
@ -294,6 +298,11 @@ func (t *AuroraTask) Priority(priority int32) *AuroraTask {
|
|||
return t
|
||||
}
|
||||
|
||||
func (t *AuroraTask) Production(production bool) *AuroraTask {
|
||||
t.task.Production = &production
|
||||
return t
|
||||
}
|
||||
|
||||
// Add a list of URIs with the same extract and cache configuration. Scheduler must have
|
||||
// --enable_mesos_fetcher flag enabled. Currently there is no duplicate detection.
|
||||
func (t *AuroraTask) AddURIs(extract bool, cache bool, values ...string) *AuroraTask {
|
||||
|
|
|
@ -35,6 +35,7 @@ func TestAuroraTask_Clone(t *testing.T) {
|
|||
Disk(1000).
|
||||
IsService(true).
|
||||
Priority(1).
|
||||
Production(false).
|
||||
AddPorts(10).
|
||||
Tier("preferred").
|
||||
MaxFailure(23).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue