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" // TransformationTypeScheduled is the transformation type for scheduled transformations TransformationTypeScheduled = "scheduled" )
Variables ¶
View Source
var ( // ErrNotScheduledType is returned when transformation is not a scheduled type ErrNotScheduledType = errors.New("transformation is not a scheduled type") // ErrCoordinatorNoQueueSupport is returned when coordinator doesn't support queue management ErrCoordinatorNoQueueSupport = errors.New("coordinator doesn't support queue management") // ErrQueueManagerNil is returned when queue manager is nil ErrQueueManagerNil = errors.New("queue manager is nil") // ErrQueueNoTransformationSupport is returned when queue doesn't support transformation enqueueing ErrQueueNoTransformationSupport = errors.New("queue manager doesn't support transformation enqueueing") // 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"`
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
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
Click to show internal directories.
Click to hide internal directories.