From 96384e6fdc5eb876f4cde79d1f3f81f3656bc102 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Thu, 7 May 2020 11:31:31 -0700 Subject: [PATCH] Renaming function in job update to reduce ambiguity about which underlying object it is modifiying. Adding support for specifying ranges in updates as well as SLA Awareness. --- jobUpdate.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/jobUpdate.go b/jobUpdate.go index 6b285df..cc2cd7f 100644 --- a/jobUpdate.go +++ b/jobUpdate.go @@ -131,8 +131,20 @@ func (j *JobUpdate) VariableBatchStrategy(autoPause bool, batchSizes ...int32) * return j } -func newUpdateSettings() *aurora.JobUpdateSettings { +// SlaAware makes the scheduler enforce the SLA Aware policy if the job meets the SLA awareness criteria. +// By default, the scheduler will only apply SLA Awareness to jobs in the production tier with 20 or more instances. +func (j *JobUpdate) SlaAware(slaAware bool) *JobUpdate { + j.request.Settings.SlaAware = &slaAware + return j +} +// AddInstanceRange allows updates to only touch a certain specific range of instances +func (j *JobUpdate) AddInstanceRange(first, last int32) *JobUpdate { + j.request.Settings.UpdateOnlyTheseInstances = append(j.request.Settings.UpdateOnlyTheseInstances, + &aurora.Range{First: first, Last: last}) + return j +} +func newUpdateSettings() *aurora.JobUpdateSettings { us := aurora.JobUpdateSettings{} // Mirrors defaults set by Pystachio us.UpdateOnlyTheseInstances = []*aurora.Range{} @@ -198,7 +210,7 @@ func (j *JobUpdate) Tier(tier string) *JobUpdate { return j } -func (j *JobUpdate) MaxFailure(maxFail int32) *JobUpdate { +func (j *JobUpdate) TaskMaxFailure(maxFail int32) *JobUpdate { j.task.MaxFailure(maxFail) return j }