jobcompleter

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncCompleter added in v0.1.0

type AsyncCompleter struct {
	baseservice.BaseService
	startstop.BaseStartStop
	// contains filtered or unexported fields
}

func NewAsyncCompleter

func NewAsyncCompleter(archetype *baseservice.Archetype, exec riverdriver.Executor, subscribeCh SubscribeChan) *AsyncCompleter

func (*AsyncCompleter) JobSetStateIfRunning added in v0.1.0

func (c *AsyncCompleter) JobSetStateIfRunning(ctx context.Context, stats *jobstats.JobStatistics, params *riverdriver.JobSetStateIfRunningParams) error

func (*AsyncCompleter) ResetSubscribeChan added in v0.7.0

func (c *AsyncCompleter) ResetSubscribeChan(subscribeCh SubscribeChan)

func (*AsyncCompleter) Start added in v0.1.0

func (c *AsyncCompleter) Start(ctx context.Context) error

type BatchCompleter added in v0.1.0

type BatchCompleter struct {
	baseservice.BaseService
	startstop.BaseStartStop
	// contains filtered or unexported fields
}

BatchCompleter accumulates incoming completions, and instead of completing them immediately, every so often complete many of them as a single efficient batch. To minimize the amount of driver surface area we need, the batching is only performed for jobs being changed to a `completed` state, which we expect to the vast common case under normal operation. The completer embeds an AsyncCompleter to perform other non-`completed` state completions.

func NewBatchCompleter added in v0.1.0

func NewBatchCompleter(archetype *baseservice.Archetype, exec riverdriver.Executor, pilot riverpilot.Pilot, subscribeCh SubscribeChan) *BatchCompleter

func (*BatchCompleter) JobSetStateIfRunning added in v0.1.0

func (c *BatchCompleter) JobSetStateIfRunning(ctx context.Context, stats *jobstats.JobStatistics, params *riverdriver.JobSetStateIfRunningParams) error

func (*BatchCompleter) ResetSubscribeChan added in v0.7.0

func (c *BatchCompleter) ResetSubscribeChan(subscribeCh SubscribeChan)

func (*BatchCompleter) Start added in v0.1.0

func (c *BatchCompleter) Start(ctx context.Context) error

type CompleterJobUpdated

type CompleterJobUpdated struct {
	Job      *rivertype.JobRow
	JobStats *jobstats.JobStatistics
}

type InlineCompleter added in v0.1.0

type InlineCompleter struct {
	baseservice.BaseService
	startstop.BaseStartStop
	// contains filtered or unexported fields
}

func NewInlineCompleter

func NewInlineCompleter(archetype *baseservice.Archetype, exec riverdriver.Executor, subscribeCh SubscribeChan) *InlineCompleter

func (*InlineCompleter) JobSetStateIfRunning added in v0.1.0

func (c *InlineCompleter) JobSetStateIfRunning(ctx context.Context, stats *jobstats.JobStatistics, params *riverdriver.JobSetStateIfRunningParams) error

func (*InlineCompleter) ResetSubscribeChan added in v0.7.0

func (c *InlineCompleter) ResetSubscribeChan(subscribeCh SubscribeChan)

func (*InlineCompleter) Start added in v0.1.0

func (c *InlineCompleter) Start(ctx context.Context) error

type JobCompleter

type JobCompleter interface {
	startstop.Service

	// JobSetState sets a new state for the given job, as long as it's
	// still running (i.e. its state has not changed to something else already).
	JobSetStateIfRunning(ctx context.Context, stats *jobstats.JobStatistics, params *riverdriver.JobSetStateIfRunningParams) error

	// ResetSubscribeChan resets the subscription channel for the completer. It
	// must only be called when the completer is stopped.
	ResetSubscribeChan(subscribeCh SubscribeChan)
}

JobCompleter is an interface to a service that "completes" jobs by marking them with an appropriate state and any other necessary metadata in the database. It's a generic interface to let us experiment with the speed of a number of implementations, although River will likely always prefer our most optimized one.

type SubscribeChan added in v0.7.0

type SubscribeChan chan<- []CompleterJobUpdated

type SubscribeFunc added in v0.7.0

type SubscribeFunc func(update CompleterJobUpdated)

SubscribeFunc will be invoked whenever a job is updated.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL