Documentation ¶
Overview ¶
Package management provides increased observability and control of the state of amboy queues.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBQueueManagerOptions ¶
type DBQueueManagerOptions struct { // SingleGroup indicates that the queue is managing a single queue group. SingleGroup bool // ByGroups indicates that the queue is managing multiple queues in a queue // group. Only a subset of operations are supported if ByGroups is // specified. ByGroups bool Options queue.MongoDBOptions }
DBQueueManagerOptions describes the arguments to the operations to construct queue managers, and accommodates both group-backed queues and conventional queues.
func (*DBQueueManagerOptions) Validate ¶
func (o *DBQueueManagerOptions) Validate() error
Validate checks the state of the manager configuration, preventing logically invalid options.
type GroupedID ¶
type GroupedID struct { ID string `bson:"_id" bson:"_id" yaml:"_id"` Group string `bson:"group,omitempty" json:"group,omitempty" yaml:"group,omitempty"` }
GroupedID represents a job's ID and the group that the job belongs to, if it's in a queue group.
type JobTypeCount ¶
JobTypeCount holds data for counts of jobs by job type and group.
type Manager ¶
type Manager interface { // JobStatus returns statistics of the number of jobs of each job type // matching the status. JobStatus(context.Context, StatusFilter) ([]JobTypeCount, error) // JobIDsByState returns a report of job IDs filtered by a job type and // status filter. Depending on the implementation, the returned job IDs can // be either logical job IDs or internally-stored job IDs. JobIDsByState(context.Context, string, StatusFilter) ([]GroupedID, error) // CompleteJob marks a job complete by ID. Implementations may differ on // whether it matches the logical job ID (i.e. (amboy.Job).ID) or // internally-stored job IDs (which may differ from the user-visible job // ID). CompleteJob(context.Context, string) error // CompleteJobs marks all jobs complete that match the given status filter. CompleteJobs(context.Context, StatusFilter) error // CompleteJobsByType marks all jobs complete that match the given status // filter and job type. CompleteJobsByType(context.Context, StatusFilter, string) error // CompleteJobsByPattern marks all jobs complete that match the given status // filter and whose job ID matches the given regular expression. // Implementations may differ on whether the pattern matches the logical job // ID (i.e. (amboy.Job).ID) or internally-stored job IDs (which may differ // from the user-visible job ID). Furthermore, implementations may differ on // the accepted pattern-matching language. CompleteJobsByPattern(context.Context, StatusFilter, string) error }
Manager is an interface that describes queue introspection tools and utility for queue management that make it possible to get more details about the running jobs in an amboy queue and gives users broader capabilities than the Queue interface itself.
func MakeDBQueueManager ¶
func MakeDBQueueManager(ctx context.Context, opts DBQueueManagerOptions) (Manager, error)
MakeDBQueueManager make it possible to produce a queue manager with an existing database Connection.
func NewDBQueueManager ¶
func NewDBQueueManager(ctx context.Context, opts DBQueueManagerOptions) (Manager, error)
NewDBQueueManager produces a queue manager for (remote) queues that persist jobs in MongoDB. This implementation does not interact with the queue directly, and manages by interacting with the database directly.
func NewQueueManager ¶
NewQueueManager returns a Manager implementation built on top of the amboy.Queue interface. This can be used to manage queues more generically.
The management algorithms may impact performance of queues, as queues may require some locking to perform the underlying operations. The performance of these operations will degrade with the number of jobs that the queue contains, so best practice is to pass contexts with timeouts to all methods.
type StatusFilter ¶
type StatusFilter string
StatusFilter defines a number of dimensions with which to filter current jobs in a queue by status
const ( Pending StatusFilter = "pending" InProgress StatusFilter = "in-progress" Stale StatusFilter = "stale" Completed StatusFilter = "completed" Retrying StatusFilter = "retrying" StaleRetrying StatusFilter = "stale-retrying" All StatusFilter = "all" )
Constants representing valid StatusFilters.
func ValidStatusFilters ¶
func ValidStatusFilters() []StatusFilter
ValidStatusFilters returns all valid status filters.
func (StatusFilter) Validate ¶
func (t StatusFilter) Validate() error
Validate returns an error if a filter value is not valid.