Documentation
¶
Index ¶
- func ClearRegistryForTests()
- func GetRegisteredModes() []string
- func RegisterNewPlugin(mode string, factory PluginFactory) error
- func RestoreRegistryForTests(m map[string]PluginFactory)
- func SnapshotRegistryForTests() map[string]PluginFactory
- type APIConfig
- type CustomScheduler
- type PluginFactory
- type Sched
- type SchedConfig
- type Scheduler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearRegistryForTests ¶
func ClearRegistryForTests()
The following helpers are intended for tests only.
func GetRegisteredModes ¶
func GetRegisteredModes() []string
GetRegisteredModes returns a list of all registered plugin modes
func RegisterNewPlugin ¶
func RegisterNewPlugin(mode string, factory PluginFactory) error
RegisterNewPlugin registers a plugin factory for a specific mode This should be called in the init() function of each plugin implementation
func RestoreRegistryForTests ¶
func RestoreRegistryForTests(m map[string]PluginFactory)
func SnapshotRegistryForTests ¶
func SnapshotRegistryForTests() map[string]PluginFactory
Types ¶
type CustomScheduler ¶
type CustomScheduler interface {
// Drain the queued task from eBPF and return the number of tasks drained
DrainQueuedTask(s Sched) int
// Select a task from the queued tasks and return it
SelectQueuedTask(s Sched) *models.QueuedTask
// Select a CPU for the given queued task, After selecting the CPU, the task will be dispatched to that CPU by Scheduler
SelectCPU(s Sched, t *models.QueuedTask) (error, int32)
// Determine the time slice for the given task
DetermineTimeSlice(s Sched, t *models.QueuedTask) uint64
// Get the number of objects in the pool (waiting to be dispatched)
// GetPoolCount will be called by the scheduler to notify the number of tasks waiting to be dispatched (NotifyComplete)
GetPoolCount() uint64
// SendMetrics sends custom metrics to the monitoring system
SendMetrics(interface{})
// GetChangedStrategies returns the list of scheduling strategies that have changed since the last call
GetChangedStrategies() ([]util.SchedulingStrategy, []util.SchedulingStrategy)
}
func NewSchedulerPlugin ¶
func NewSchedulerPlugin(ctx context.Context, config *SchedConfig) (CustomScheduler, error)
NewSchedulerPlugin creates a new scheduler plugin based on the configuration This is the factory function that follows the simple factory pattern
type PluginFactory ¶
type PluginFactory func(ctx context.Context, config *SchedConfig) (CustomScheduler, error)
PluginFactory is a function type that creates a CustomScheduler instance
type Sched ¶
type Sched interface {
DequeueTask(task *models.QueuedTask)
DefaultSelectCPU(t *models.QueuedTask) (error, int32)
}
type SchedConfig ¶
type SchedConfig struct {
// Mode specifies which scheduler plugin to use (e.g., "gthulhu", "simple", "simple-fifo")
Mode string `yaml:"mode"`
// Scheduler configuration (for Gthulhu plugin)
// These match the parameters that would be passed from the Gthulhu main repo
Scheduler Scheduler `yaml:"scheduler"`
// API configuration
APIConfig APIConfig `yaml:"api_config"`
}
SchedConfig holds the configuration parameters for creating a scheduler plugin
Click to show internal directories.
Click to hide internal directories.