worker

package
v0.0.0-...-511e509 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseNodeLabels

func ParseNodeLabels(raw string) map[string]string

func SubscribeWakeups

func SubscribeWakeups(ctx context.Context, bus event.Bus) <-chan struct{}

Types

type Claimer

type Claimer struct {
	// contains filtered or unexported fields
}

func NewClaimer

func NewClaimer(nodeID string, store *run.Store, leaseTTL time.Duration, nodeLabels ...map[string]string) *Claimer

func (*Claimer) ClaimNext

func (c *Claimer) ClaimNext(ctx context.Context) (*models.TaskRun, error)

ClaimNext claims one ready task, or returns nil when no tasks are available.

func (*Claimer) ReclaimExpired

func (c *Claimer) ReclaimExpired(ctx context.Context) error

type ExpiredReclaimer

type ExpiredReclaimer interface {
	ReclaimExpired(ctx context.Context) error
}

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool bounds concurrent goroutines using a semaphore.

func NewPool

func NewPool(size int) *Pool

func (*Pool) Submit

func (p *Pool) Submit(ctx context.Context, fn func()) error

func (*Pool) Wait

func (p *Pool) Wait()

type TaskClaimer

type TaskClaimer interface {
	ClaimNext(ctx context.Context) (*models.TaskRun, error)
}

type TaskExecutor

type TaskExecutor func(ctx context.Context, task *models.TaskRun)

func NewRuntimeExecutor

func NewRuntimeExecutor(store *run.Store, taskTimeout, workerLeaseTTL time.Duration, failurePolicy string) TaskExecutor

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(claimer TaskClaimer, pool *Pool, pollInterval time.Duration, executor TaskExecutor) *Worker

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

func (*Worker) WithWakeups

func (w *Worker) WithWakeups(ch <-chan struct{}) *Worker

Jump to

Keyboard shortcuts

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