Documentation
¶
Overview ¶
Package runwatch finds runs that stopped without finishing, such as runs whose coordinator was killed, and records them for the Web inbox. A run's own process cannot report that it was killed; rotari web looks for such runs instead. A run whose coordinator is on another host is judged by its heartbeat, which only suggests that it stopped.
Index ¶
Constants ¶
const Interval = 30 * time.Second
Interval is how often rotari web looks for interrupted runs.
const UnresponsiveAfter = state.HeartbeatStaleAfter
UnresponsiveAfter is how long a remote run's heartbeat must stay unchanged, by the watcher's own clock, before the run is reported unresponsive.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Watcher ¶ added in v0.1.31
type Watcher struct {
// contains filtered or unexported fields
}
Watcher finds runs that stopped without finishing and records them for the Web inbox. A local run whose coordinator is dead is interrupted. An active run whose coordinator is on another host or in another PID namespace, which this host cannot check, is unresponsive once its heartbeat has not changed for UnresponsiveAfter. A Watcher remembers the heartbeats it saw between calls of Report, so one watcher must be kept for the life of the process; it is not safe for concurrent use.
func NewWatcher ¶ added in v0.1.31
func NewWatcher() *Watcher
NewWatcher returns a Watcher that has seen no heartbeat yet, so it calls no run unresponsive before UnresponsiveAfter has passed.
func (*Watcher) Report ¶ added in v0.1.31
func (watcher *Watcher) Report(log notificationlog.Log, baseDirs []string, now time.Time) (int, error)
Report records a run.interrupted notification for each run in baseDirs that project.Inspect finds interrupted, and a run.unresponsive one for each remote run whose heartbeat has stopped, unless the run already has one. A project whose state lock is held is looked at again on the next call. It returns how many notifications it recorded; a project it cannot inspect or record is an error that does not stop the others.