worker

package
v1.0.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeartbeatInterval = 5 * time.Second
	ReportTimeout     = 10 * time.Second
)

Variables

View Source
var (
	Hostname string
	Username string
	PID      int
)
View Source
var ErrTaskCancelledAfterFailedHeartbeat = errors.New("task cancelled after failed heartbeat")

Functions

This section is empty.

Types

type Bundle

type Bundle interface {
	LookupTask(dagId, taskId string) (Task, bool)
}

Bundle interface defines a type that is used "at execution time" to lookup a Task to execute

type Task

type Task interface {
	Execute(ctx context.Context, logger *slog.Logger) error
}

task is an interface of an task implementation.

type Worker

type Worker interface {
	Bundle

	ExecuteTaskWorkload(ctx context.Context, workload api.ExecuteTaskWorkload) error

	WithServer(server string) (Worker, error)
	WithClient(client api.ClientInterface) Worker
	WithHeartbeatInterval(interval time.Duration) Worker
}

func New

func New(logger *slog.Logger) Worker

func NewWithBundle

func NewWithBundle(bundle Bundle, logger *slog.Logger) Worker

Jump to

Keyboard shortcuts

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