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:
parent
a4b89feb0e
commit
79f06bfa81
1 changed files with 20 additions and 5 deletions
25
monitors.go
25
monitors.go
|
@ -129,11 +129,26 @@ func (m *Monitor) JobUpdateQuery(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instances will monitor a Job until all instances enter one of the LIVE_STATES
|
// PausedUpdateMonitor polls Aurora for information about a job update until the job update has entered into
|
||||||
func (m *Monitor) Instances(
|
// a ROLL_FORWARD_PAUSED state.
|
||||||
key *aurora.JobKey,
|
func (m *Monitor) PausedUpdateMonitor(key aurora.JobUpdateKey, interval, timeout time.Duration) (bool, error) {
|
||||||
instances int32,
|
_, err := m.JobUpdateQuery(aurora.JobUpdateQuery{
|
||||||
interval, timeout int) (bool, error) {
|
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)
|
return m.ScheduleStatus(key, instances, LiveStates, interval, timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue