func (m *Monitor) JobUpdateStatus(updateKey aurora.JobUpdateKey,
	desiredStatuses []aurora.JobUpdateStatus,
	interval, timeout time.Duration) (aurora.JobUpdateStatus, error) {
	updateQ := aurora.JobUpdateQuery{
		Key:            &updateKey,
		Limit:          1,
		UpdateStatuses: desiredStatuses,
	}
	summary, err := m.JobUpdateQuery(updateQ, interval, timeout)
	if err != nil {
		return 0, err
	}
	return summary[0].State.Status, nil
}
JobUpdateStatus polls the scheduler every certain amount of time to see if the update has entered a specified state.
package realis
import (
	"time"
	"github.com/paypal/gorealis/gen-go/apache/aurora"
	"github.com/pkg/errors"
)
type Monitor struct {
	Client Realis
}
func (m *Monitor) JobUpdate(
	updateKey aurora.JobUpdateKey,
	interval int,
	timeout int) (bool, error) {
	updateQ := aurora.JobUpdateQuery{
		Key:            &updateKey,
		Limit:          1,
		UpdateStatuses: TerminalUpdateStates(),
	}
	updateSummaries, err := m.JobUpdateQuery(
		updateQ,
		time.Duration(interval)*time.Second,
		time.Duration(timeout)*time.Second)
	status := updateSummaries[0].State.Status
	if err != nil {
		return false, err
	}
	m.Client.RealisConfig().logger.Printf("job update status: %v\n", status)
	switch status {
	case aurora.JobUpdateStatus_ROLLED_FORWARD:
		return true, nil
	case aurora.JobUpdateStatus_ROLLED_BACK,
		aurora.JobUpdateStatus_ABORTED,
		aurora.JobUpdateStatus_ERROR,
		aurora.JobUpdateStatus_FAILED:
		return false, errors.Errorf("bad terminal state for update: %v", status)
	default:
		return false, errors.Errorf("unexpected update state: %v", status)
	}
}