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.

This commit is contained in:
Renan DelValle 2019-08-29 18:07:43 -07:00
parent a4b89feb0e
commit 79f06bfa81
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9

View file

@ -129,11 +129,26 @@ func (m *Monitor) JobUpdateQuery(
}
}
// Instances will monitor a Job until all instances enter one of the LIVE_STATES
func (m *Monitor) Instances(
key *aurora.JobKey,
instances int32,
interval, timeout int) (bool, error) {
// PausedUpdateMonitor polls Aurora for information about a job update until the job update has entered into
// a ROLL_FORWARD_PAUSED state.
func (m *Monitor) PausedUpdateMonitor(key aurora.JobUpdateKey, interval, timeout time.Duration) (bool, error) {
_, err := m.JobUpdateQuery(aurora.JobUpdateQuery{
UpdateStatuses: []aurora.JobUpdateStatus{aurora.JobUpdateStatus_ROLL_FORWARD_PAUSED},
Key: &key,
Limit: 1,
},
interval,
timeout)
if err != nil {
return false, errors.Wrap(err, "update has not entered paused state")
}
return true, err
}
// Monitor a Job until all instances enter one of the LIVE_STATES
func (m *Monitor) Instances(key *aurora.JobKey, instances int32, interval, timeout int) (bool, error) {
return m.ScheduleStatus(key, instances, LiveStates, interval, timeout)
}