Documentation
¶
Overview ¶
Package executor describes a running engine (an executor): who it is, what it is doing and what it has done. The engine produces these snapshots; reporters (the conductor agent, metrics exporters, your own observers) read them on their own schedules.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Report ¶
func Report(ctx context.Context, src Source, interval func() time.Duration, minGap time.Duration, send func())
Report calls send now and then every interval() until ctx ends. When src is a Notifier it also sends after each change, but no sooner than minGap after the previous send, so bursts coalesce. interval is re-read each round, so it may change.
Types ¶
type Announcer ¶
type Announcer interface {
Announce(Change)
}
Announcer hears every Change an engine makes, as it makes it, from the goroutine that made it. Announce must not block.
type Change ¶
type Change struct {
Kind ChangeKind
ActivityID uuid.UUID
ActivityType string
// RootID is the activity's workflow root: its own id for a root.
RootID uuid.UUID
// Attempt is set for AttemptStarted and AttemptSucceeded.
Attempt int
At time.Time
}
Change is one lifecycle change this executor made.
type ChangeKind ¶
type ChangeKind int
ChangeKind is a lifecycle change no event is stored for: the activity's own times say it, so it can only be announced as it happens.
const ( Created ChangeKind = iota // submitted, runnable now Scheduled // submitted to run later AttemptStarted // claimed by this executor AttemptSucceeded // completed by this executor )
type Counters ¶
type Counters struct {
// Claimed counts activities that started executing here.
Claimed uint64
// Succeeded completed; Retried asked for another attempt; Failed failed
// for good; TimedOut ran past their timeout; DeadLettered ran out of
// attempts.
Succeeded, Retried, Failed, TimedOut, DeadLettered uint64
// ClaimsLost counts activities another worker took over from here.
ClaimsLost uint64
// HeartbeatFailures counts failed claim renewals.
HeartbeatFailures uint64
// LastClaimLag is how long the last claimed activity waited after it
// was due.
LastClaimLag time.Duration
}
Counters are what an executor has done since it started.
type Info ¶
type Info struct {
// ID is unique per run: the engine's InstanceID.
ID string
Queue string
ActivityTypes []string
MaxConcurrency int
StartedAt time.Time
Hostname string
SDK SDK
// Labels are tags (region, deploy version) from WorkerConfig.Labels.
Labels map[string]string
}
Info identifies an executor; it is fixed for the run.
type Notifier ¶
type Notifier interface {
Changed() <-chan struct{}
}
Notifier is implemented by a Source (such as the engine) that signals state changes: an activity starts or finishes, or a drain begins. Changed returns a channel closed at the next change after the call.
type Observer ¶
Observer hears an executor start and stop and reads the Source on its own schedule. Both calls must return promptly. An engine notifies every Observer registered with WorkerEngine.Observe.
type SDK ¶
type SDK struct {
Name, Version, Language string
}
SDK names the RunnerQ SDK the executor runs.
type Signal ¶
type Signal struct {
// contains filtered or unexported fields
}
Signal implements Notifier for any number of waiters. The zero value is ready to use.