Documentation ¶
Overview ¶
Package allocwatcher allows blocking until another allocation - whether running locally or remotely - completes and migrates the allocation directory if necessary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAllocWatcher ¶
func NewAllocWatcher(c Config) (config.PrevAllocWatcher, config.PrevAllocMigrator)
NewAllocWatcher creates a PrevAllocWatcher if either PreviousAllocation or PreemptedRunners are set. If any of the allocs to watch have local runners, wait for them to terminate directly. For allocs which are either running on another node or have already terminated their alloc runners, use a remote backend which watches the alloc status via rpc.
func NewGroupAllocWatcher ¶
func NewGroupAllocWatcher(watchers ...config.PrevAllocWatcher) config.PrevAllocWatcher
Types ¶
type AllocRunnerMeta ¶
type AllocRunnerMeta interface { GetAllocDir() *allocdir.AllocDir Listener() *cstructs.AllocListener Alloc() *structs.Allocation }
AllocRunnerMeta provides metadata about an AllocRunner such as its alloc and alloc dir.
type Config ¶
type Config struct { // Alloc is the current allocation which may need to block on its // previous allocation stopping. Alloc *structs.Allocation // PreviousRunner is non-nil if Alloc has a PreviousAllocation and it is // running locally. PreviousRunner AllocRunnerMeta // PreemptedRunners is non-nil if Alloc has one or more PreemptedAllocations. PreemptedRunners map[string]AllocRunnerMeta // RPC allows the alloc watcher to monitor remote allocations. RPC RPCer // Config is necessary for using the RPC. Config *config.Config // MigrateToken is used to migrate remote alloc dirs when ACLs are // enabled. MigrateToken string Logger hclog.Logger }
type NoopPrevAlloc ¶
type NoopPrevAlloc struct{}
NoopPrevAlloc does not block or migrate on a previous allocation and never returns an error.
func (NoopPrevAlloc) IsMigrating ¶
func (NoopPrevAlloc) IsMigrating() bool
func (NoopPrevAlloc) IsWaiting ¶
func (NoopPrevAlloc) IsWaiting() bool