scheduler

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: GPL-3.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package scheduler provides task scheduling services

Index

Constants

View Source
const (
	// TransformationTaskPrefix is the prefix for transformation scheduled tasks
	TransformationTaskPrefix = "transformation:"
	// ConsolidationTaskType is the task type for consolidation
	ConsolidationTaskType = "consolidation"
	// ExternalTaskPrefix is the prefix for external model tasks
	ExternalTaskPrefix = "external:"
	// QueueName is the queue name for scheduler tasks
	QueueName = "scheduler"
)

Variables

View Source
var (
	// ErrScheduleRegistrationFailed is returned when one or more scheduled tasks fail to register
	ErrScheduleRegistrationFailed = errors.New("failed to register scheduled tasks")
	// ErrInvalidExternalTaskType is returned when the external task type format is invalid
	ErrInvalidExternalTaskType = errors.New("invalid external task type format")
)
View Source
var (
	// ErrElectorStopped is returned when the elector is stopped while waiting for leadership
	ErrElectorStopped = errors.New("elector stopped while waiting for leadership")
)
View Source
var (
	// ErrInvalidConcurrency is returned when concurrency is not positive
	ErrInvalidConcurrency = errors.New("concurrency must be positive")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Concurrency   int    `yaml:"concurrency" default:"10"`
	Consolidation string `yaml:"consolidation" default:"@every 10m"`
}

Config defines scheduler configuration

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the scheduler configuration is valid

type CoordinatorClient added in v0.0.2

type CoordinatorClient interface {
	Process(transformation models.Transformation, direction coordinator.Direction)
}

CoordinatorClient defines the minimal interface needed from coordinator

type LeaderElector added in v0.0.20

type LeaderElector interface {
	Start(ctx context.Context) error
	Stop() error
	IsLeader() bool
	WaitForLeadership(ctx context.Context) error
}

LeaderElector manages distributed leader election using Redis

func NewLeaderElector added in v0.0.20

func NewLeaderElector(log logrus.FieldLogger, redisOpt *redis.Options) LeaderElector

NewLeaderElector creates a new leader elector instance

type Service

type Service interface {
	// Start initializes and starts the scheduler service
	Start(ctx context.Context) error

	// Stop gracefully shuts down the scheduler service
	Stop() error
}

Service defines the public interface for the scheduler

func NewService

func NewService(log logrus.FieldLogger, cfg *Config, redisOpt *redis.Options, dag models.DAGReader, coord coordinator.Service, adminService admin.Service) (Service, error)

NewService creates a new scheduler service

Jump to

Keyboard shortcuts

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