Documentation
¶
Overview ¶
Package scheduler provides task scheduling services
Index ¶
Constants ¶
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" // TransformationTypeScheduled is the transformation type for scheduled transformations TransformationTypeScheduled = "scheduled" )
Variables ¶
var ( // ErrNotScheduledType is returned when transformation is not a scheduled type ErrNotScheduledType = errors.New("transformation is not a scheduled type") // ErrInvalidExternalTaskType is returned when the external task type format is invalid ErrInvalidExternalTaskType = errors.New("invalid external task type format") )
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"`
ShutdownTimeout int `yaml:"shutdownTimeout" default:"10"`
}
Config defines scheduler configuration
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
// PromotedChan returns a channel that signals when this instance is promoted to leader
PromotedChan() <-chan struct{}
// DemotedChan returns a channel that signals when this instance is demoted from leader
DemotedChan() <-chan struct{}
}
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
// SetLiveOverrides sets the live override applier (must be called before Start)
SetLiveOverrides(lo *liveconfig.Applier)
}
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