Adding autopause APIs to future (#110)
* Updating thrift definitions to add autopause for batch based update strategies. * Adding batch calculator utility and test cases for it. * Adding PauseUpdateMonitor which allows users to poll Aurora for information on an active Update being carried out until it enters the ROLL_FORWARD_PAUSED state. * Tests for PauseUpdateMonitor and VariableBatchStep added to the end to end tests. * Adding TerminalUpdateStates function which returns a slice containing all terminal states for an update. Changed signature of JobUpdateStatus from using a map for desired states to a slice. A map is no longer necessary with the new version of thrift and only adds complexity.
This commit is contained in:
parent
fe692040aa
commit
976dc26dcc
9 changed files with 285 additions and 28 deletions
|
@ -10137,8 +10137,10 @@ func (p *QueueJobUpdateStrategy) String() string {
|
|||
//
|
||||
// Attributes:
|
||||
// - GroupSize
|
||||
// - AutopauseAfterBatch
|
||||
type BatchJobUpdateStrategy struct {
|
||||
GroupSize int32 `thrift:"groupSize,1" db:"groupSize" json:"groupSize"`
|
||||
AutopauseAfterBatch bool `thrift:"autopauseAfterBatch,2" db:"autopauseAfterBatch" json:"autopauseAfterBatch"`
|
||||
}
|
||||
|
||||
func NewBatchJobUpdateStrategy() *BatchJobUpdateStrategy {
|
||||
|
@ -10149,6 +10151,10 @@ func NewBatchJobUpdateStrategy() *BatchJobUpdateStrategy {
|
|||
func (p *BatchJobUpdateStrategy) GetGroupSize() int32 {
|
||||
return p.GroupSize
|
||||
}
|
||||
|
||||
func (p *BatchJobUpdateStrategy) GetAutopauseAfterBatch() bool {
|
||||
return p.AutopauseAfterBatch
|
||||
}
|
||||
func (p *BatchJobUpdateStrategy) Read(iprot thrift.TProtocol) error {
|
||||
if _, err := iprot.ReadStructBegin(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
|
||||
|
@ -10172,6 +10178,16 @@ func (p *BatchJobUpdateStrategy) Read(iprot thrift.TProtocol) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
if fieldTypeId == thrift.BOOL {
|
||||
if err := p.ReadField2(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := iprot.Skip(fieldTypeId); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
default:
|
||||
if err := iprot.Skip(fieldTypeId); err != nil {
|
||||
return err
|
||||
|
@ -10196,11 +10212,21 @@ func (p *BatchJobUpdateStrategy) ReadField1(iprot thrift.TProtocol) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *BatchJobUpdateStrategy) ReadField2(iprot thrift.TProtocol) error {
|
||||
if v, err := iprot.ReadBool(); err != nil {
|
||||
return thrift.PrependError("error reading field 2: ", err)
|
||||
} else {
|
||||
p.AutopauseAfterBatch = v
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *BatchJobUpdateStrategy) Write(oprot thrift.TProtocol) error {
|
||||
if err := oprot.WriteStructBegin("BatchJobUpdateStrategy"); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
|
||||
if p != nil {
|
||||
if err := p.writeField1(oprot); err != nil { return err }
|
||||
if err := p.writeField2(oprot); err != nil { return err }
|
||||
}
|
||||
if err := oprot.WriteFieldStop(); err != nil {
|
||||
return thrift.PrependError("write field stop error: ", err) }
|
||||
|
@ -10219,6 +10245,16 @@ func (p *BatchJobUpdateStrategy) writeField1(oprot thrift.TProtocol) (err error)
|
|||
return err
|
||||
}
|
||||
|
||||
func (p *BatchJobUpdateStrategy) writeField2(oprot thrift.TProtocol) (err error) {
|
||||
if err := oprot.WriteFieldBegin("autopauseAfterBatch", thrift.BOOL, 2); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:autopauseAfterBatch: ", p), err) }
|
||||
if err := oprot.WriteBool(bool(p.AutopauseAfterBatch)); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T.autopauseAfterBatch (2) field write error: ", p), err) }
|
||||
if err := oprot.WriteFieldEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:autopauseAfterBatch: ", p), err) }
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *BatchJobUpdateStrategy) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
|
@ -10231,8 +10267,10 @@ func (p *BatchJobUpdateStrategy) String() string {
|
|||
//
|
||||
// Attributes:
|
||||
// - GroupSizes
|
||||
// - AutopauseAfterBatch
|
||||
type VariableBatchJobUpdateStrategy struct {
|
||||
GroupSizes []int32 `thrift:"groupSizes,1" db:"groupSizes" json:"groupSizes"`
|
||||
AutopauseAfterBatch bool `thrift:"autopauseAfterBatch,2" db:"autopauseAfterBatch" json:"autopauseAfterBatch"`
|
||||
}
|
||||
|
||||
func NewVariableBatchJobUpdateStrategy() *VariableBatchJobUpdateStrategy {
|
||||
|
@ -10243,6 +10281,10 @@ func NewVariableBatchJobUpdateStrategy() *VariableBatchJobUpdateStrategy {
|
|||
func (p *VariableBatchJobUpdateStrategy) GetGroupSizes() []int32 {
|
||||
return p.GroupSizes
|
||||
}
|
||||
|
||||
func (p *VariableBatchJobUpdateStrategy) GetAutopauseAfterBatch() bool {
|
||||
return p.AutopauseAfterBatch
|
||||
}
|
||||
func (p *VariableBatchJobUpdateStrategy) Read(iprot thrift.TProtocol) error {
|
||||
if _, err := iprot.ReadStructBegin(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
|
||||
|
@ -10266,6 +10308,16 @@ func (p *VariableBatchJobUpdateStrategy) Read(iprot thrift.TProtocol) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
if fieldTypeId == thrift.BOOL {
|
||||
if err := p.ReadField2(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := iprot.Skip(fieldTypeId); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
default:
|
||||
if err := iprot.Skip(fieldTypeId); err != nil {
|
||||
return err
|
||||
|
@ -10303,11 +10355,21 @@ var _elem25 int32
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *VariableBatchJobUpdateStrategy) ReadField2(iprot thrift.TProtocol) error {
|
||||
if v, err := iprot.ReadBool(); err != nil {
|
||||
return thrift.PrependError("error reading field 2: ", err)
|
||||
} else {
|
||||
p.AutopauseAfterBatch = v
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *VariableBatchJobUpdateStrategy) Write(oprot thrift.TProtocol) error {
|
||||
if err := oprot.WriteStructBegin("VariableBatchJobUpdateStrategy"); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
|
||||
if p != nil {
|
||||
if err := p.writeField1(oprot); err != nil { return err }
|
||||
if err := p.writeField2(oprot); err != nil { return err }
|
||||
}
|
||||
if err := oprot.WriteFieldStop(); err != nil {
|
||||
return thrift.PrependError("write field stop error: ", err) }
|
||||
|
@ -10334,6 +10396,16 @@ func (p *VariableBatchJobUpdateStrategy) writeField1(oprot thrift.TProtocol) (er
|
|||
return err
|
||||
}
|
||||
|
||||
func (p *VariableBatchJobUpdateStrategy) writeField2(oprot thrift.TProtocol) (err error) {
|
||||
if err := oprot.WriteFieldBegin("autopauseAfterBatch", thrift.BOOL, 2); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:autopauseAfterBatch: ", p), err) }
|
||||
if err := oprot.WriteBool(bool(p.AutopauseAfterBatch)); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T.autopauseAfterBatch (2) field write error: ", p), err) }
|
||||
if err := oprot.WriteFieldEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:autopauseAfterBatch: ", p), err) }
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *VariableBatchJobUpdateStrategy) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue