Upgrade to Aurora 0.22.0 (#5)
* Upgrading to Thrift 0.13.1. This version is a fork of 0.13.0 with a patch on top of it to fix an issue where trying a realis call after the connection has been closed results in a panic. * Upgrading compose set up to Mesos 1.6.2 and Aurora 0.22.0. * Adding support for using different update strategies. * Adding a monitor that is friendly with auto pause. * Adding tests for new update strategies.
This commit is contained in:
parent
1d8afcd329
commit
69ced895e2
15 changed files with 2013 additions and 1068 deletions
54
jobUpdate.go
54
jobUpdate.go
|
@ -31,32 +31,36 @@ type JobUpdate struct {
|
|||
func NewJobUpdate() *JobUpdate {
|
||||
newTask := NewTask()
|
||||
|
||||
req := aurora.JobUpdateRequest{}
|
||||
req.TaskConfig = newTask.TaskConfig()
|
||||
req.Settings = newUpdateSettings()
|
||||
|
||||
return &JobUpdate{task: newTask, request: &req}
|
||||
return &JobUpdate{
|
||||
task: newTask,
|
||||
request: &aurora.JobUpdateRequest{TaskConfig: newTask.TaskConfig(), Settings: newUpdateSettings()},
|
||||
}
|
||||
}
|
||||
|
||||
// Creates an update with default values using an AuroraTask as the underlying task configuration.
|
||||
// This function has a high level understanding of Aurora Tasks and thus will support copying a task that is configured
|
||||
// to use Thermos.
|
||||
func JobUpdateFromAuroraTask(task *AuroraTask) *JobUpdate {
|
||||
newTask := task.Clone()
|
||||
|
||||
req := aurora.JobUpdateRequest{}
|
||||
req.TaskConfig = newTask.TaskConfig()
|
||||
req.Settings = newUpdateSettings()
|
||||
|
||||
return &JobUpdate{task: newTask, request: &req}
|
||||
return &JobUpdate{
|
||||
task: newTask,
|
||||
request: &aurora.JobUpdateRequest{TaskConfig: newTask.TaskConfig(), Settings: newUpdateSettings()},
|
||||
}
|
||||
}
|
||||
|
||||
// JobUpdateFromConfig creates an update with default values using an aurora.TaskConfig
|
||||
// primitive as the underlying task configuration.
|
||||
// This function should not be used unless the implications of using a primitive value are understood.
|
||||
// For example, the primitive has no concept of Thermos.
|
||||
func JobUpdateFromConfig(task *aurora.TaskConfig) *JobUpdate {
|
||||
// Perform a deep copy to avoid unexpected behavior
|
||||
newTask := TaskFromThrift(task)
|
||||
|
||||
req := aurora.JobUpdateRequest{}
|
||||
req.TaskConfig = newTask.TaskConfig()
|
||||
req.Settings = newUpdateSettings()
|
||||
|
||||
return &JobUpdate{task: newTask, request: &req}
|
||||
return &JobUpdate{
|
||||
task: newTask,
|
||||
request: &aurora.JobUpdateRequest{TaskConfig: newTask.TaskConfig(), Settings: newUpdateSettings()},
|
||||
}
|
||||
}
|
||||
|
||||
// Set instance count the job will have after the update.
|
||||
|
@ -106,6 +110,26 @@ func (j *JobUpdate) PulseIntervalTimeout(timeout time.Duration) *JobUpdate {
|
|||
j.request.Settings.BlockIfNoPulsesAfterMs = thrift.Int32Ptr(int32(timeout.Seconds() * 1000))
|
||||
return j
|
||||
}
|
||||
func (j *JobUpdate) BatchUpdateStrategy(autoPause bool, batchSize int32) *JobUpdate {
|
||||
j.request.Settings.UpdateStrategy = &aurora.JobUpdateStrategy{
|
||||
BatchStrategy: &aurora.BatchJobUpdateStrategy{GroupSize: batchSize, AutopauseAfterBatch: autoPause},
|
||||
}
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) QueueUpdateStrategy(groupSize int32) *JobUpdate {
|
||||
j.request.Settings.UpdateStrategy = &aurora.JobUpdateStrategy{
|
||||
QueueStrategy: &aurora.QueueJobUpdateStrategy{GroupSize: groupSize},
|
||||
}
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) VariableBatchStrategy(autoPause bool, batchSizes ...int32) *JobUpdate {
|
||||
j.request.Settings.UpdateStrategy = &aurora.JobUpdateStrategy{
|
||||
VarBatchStrategy: &aurora.VariableBatchJobUpdateStrategy{GroupSizes: batchSizes, AutopauseAfterBatch: autoPause},
|
||||
}
|
||||
return j
|
||||
}
|
||||
|
||||
func newUpdateSettings() *aurora.JobUpdateSettings {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue