Documentation ¶
Index ¶
- Variables
- func InitSchedPolicyCharacteristics(schedPoliciesConfigFilename string) error
- func IsTerminal(state *mesos.TaskState) bool
- func LaunchTasks(offerIDs []*mesos.OfferID, tasksToLaunch []*mesos.TaskInfo, ...)
- func NameFor(state *mesos.TaskState) string
- func SchedFactory(opts ...SchedulerOptions) sched.Scheduler
- func SortNTasks(tasks []def.Task, n int, sb def.SortBy)
- type BaseScheduler
- func (s *BaseScheduler) Disconnected(sched.SchedulerDriver)
- func (s *BaseScheduler) Error(_ sched.SchedulerDriver, err string)
- func (s *BaseScheduler) ExecutorLost(_ sched.SchedulerDriver, executorID *mesos.ExecutorID, slaveID *mesos.SlaveID, ...)
- func (s *BaseScheduler) FrameworkMessage(driver sched.SchedulerDriver, executorID *mesos.ExecutorID, ...)
- func (s *BaseScheduler) Log(lmt elekLogDef.LogMessageType, msg string)
- func (s *BaseScheduler) LogClsfnAndTaskDistOverhead(overhead time.Duration)
- func (s *BaseScheduler) LogCoLocatedTasks(slaveID string)
- func (s *BaseScheduler) LogDisconnected()
- func (s *BaseScheduler) LogElectronError(err error)
- func (s *BaseScheduler) LogExecutorLost(executorID *mesos.ExecutorID, slaveID *mesos.SlaveID)
- func (s *BaseScheduler) LogFrameworkMessage(executorID *mesos.ExecutorID, slaveID *mesos.SlaveID, message string)
- func (s *BaseScheduler) LogFrameworkRegistered(frameworkID *mesos.FrameworkID, masterInfo *mesos.MasterInfo)
- func (s *BaseScheduler) LogFrameworkReregistered(masterInfo *mesos.MasterInfo)
- func (s *BaseScheduler) LogInsufficientResourcesDeclineOffer(offer *mesos.Offer, offerResources ...interface{})
- func (s *BaseScheduler) LogMesosError(err string)
- func (s *BaseScheduler) LogNoPendingTasksDeclineOffers(offer *mesos.Offer)
- func (s *BaseScheduler) LogNumberOfRunningTasks()
- func (s *BaseScheduler) LogOfferRescinded(offerID *mesos.OfferID)
- func (s *BaseScheduler) LogOffersReceived(offers []*mesos.Offer)
- func (s *BaseScheduler) LogSchedPolicySwitch(name string, nextPolicy SchedPolicyState)
- func (s *BaseScheduler) LogSchedTrace(taskToSchedule *mesos.TaskInfo, offer *mesos.Offer)
- func (s *BaseScheduler) LogSlaveLost(slaveID *mesos.SlaveID)
- func (s *BaseScheduler) LogTaskStarting(ts *def.Task, offer *mesos.Offer)
- func (s *BaseScheduler) LogTaskStatusUpdate(status *mesos.TaskStatus)
- func (s *BaseScheduler) LogTaskWattsConsideration(ts def.Task, host string, wattsToConsider float64)
- func (s *BaseScheduler) LogTerminateScheduler()
- func (s *BaseScheduler) OfferRescinded(_ sched.SchedulerDriver, offerID *mesos.OfferID)
- func (s *BaseScheduler) Registered(_ sched.SchedulerDriver, frameworkID *mesos.FrameworkID, ...)
- func (s *BaseScheduler) Reregistered(_ sched.SchedulerDriver, masterInfo *mesos.MasterInfo)
- func (s *BaseScheduler) ResourceOffers(driver sched.SchedulerDriver, offers []*mesos.Offer)
- func (s *BaseScheduler) SlaveLost(_ sched.SchedulerDriver, slaveID *mesos.SlaveID)
- func (s *BaseScheduler) StatusUpdate(driver sched.SchedulerDriver, status *mesos.TaskStatus)
- func (s *BaseScheduler) SwitchSchedPol(newSchedPol SchedPolicyState)
- type BinPackSortedWatts
- func (s *BinPackSortedWatts) ConsumeOffers(spc SchedPolicyContext, driver sched.SchedulerDriver, offers []*mesos.Offer)
- func (bsps *BinPackSortedWatts) GetInfo() (info struct{ ... })
- func (bsps *BinPackSortedWatts) SwitchIfNecessary(spc SchedPolicyContext)
- func (bsps *BinPackSortedWatts) UpdateLinks(info struct{ ... })
- type ElectronScheduler
- type FirstFit
- type MaxGreedyMins
- func (s *MaxGreedyMins) CheckFit(spc SchedPolicyContext, i int, task def.Task, wattsConsideration float64, ...) (bool, *mesos.TaskInfo)
- func (s *MaxGreedyMins) ConsumeOffers(spc SchedPolicyContext, driver sched.SchedulerDriver, offers []*mesos.Offer)
- func (bsps *MaxGreedyMins) GetInfo() (info struct{ ... })
- func (bsps *MaxGreedyMins) SwitchIfNecessary(spc SchedPolicyContext)
- func (bsps *MaxGreedyMins) UpdateLinks(info struct{ ... })
- type MaxMin
- func (s *MaxMin) CheckFit(spc SchedPolicyContext, i int, task def.Task, wattsConsideration float64, ...) (bool, *mesos.TaskInfo)
- func (s *MaxMin) ConsumeOffers(spc SchedPolicyContext, driver sched.SchedulerDriver, offers []*mesos.Offer)
- func (bsps *MaxMin) GetInfo() (info struct{ ... })
- func (bsps *MaxMin) SwitchIfNecessary(spc SchedPolicyContext)
- func (bsps *MaxMin) UpdateLinks(info struct{ ... })
- type SchedPolicyContext
- type SchedPolicyState
- type SchedulerOptions
- func WithClassMapWatts(cmw bool) SchedulerOptions
- func WithDone(done chan struct{}) SchedulerOptions
- func WithFixedSchedulingWindow(toFixSchedWindow bool, fixedSchedWindowSize int) SchedulerOptions
- func WithLoggingChannels(lmt chan elekLogDef.LogMessageType, msg chan string) SchedulerOptions
- func WithNameOfFirstSchedPolToFix(nameOfFirstSchedPol string) SchedulerOptions
- func WithPCPLog(pcpLog chan struct{}) SchedulerOptions
- func WithRecordPCP(recordPCP *bool) SchedulerOptions
- func WithSchedPolSwitchEnabled(enableSchedPolicySwitch bool, switchingCriteria string) SchedulerOptions
- func WithSchedPolicy(schedPolicyName string) SchedulerOptions
- func WithShutdown(shutdown chan struct{}) SchedulerOptions
- func WithTasks(ts []def.Task) SchedulerOptions
- func WithWattsAsAResource(waar bool) SchedulerOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var SchedPolicies map[string]SchedPolicyState = map[string]SchedPolicyState{ // contains filtered or unexported fields }
Scheduling policy factory
Functions ¶
func InitSchedPolicyCharacteristics ¶
Initialize scheduling policy characteristics using the provided config file.
func IsTerminal ¶
IsTerminal determines if a TaskState is a terminal state, i.e. if it singals that the task has stopped running.
func LaunchTasks ¶
func LaunchTasks(offerIDs []*mesos.OfferID, tasksToLaunch []*mesos.TaskInfo, driver sched.SchedulerDriver)
Launch tasks.
func SchedFactory ¶
func SchedFactory(opts ...SchedulerOptions) sched.Scheduler
Types ¶
type BaseScheduler ¶
type BaseScheduler struct { ElectronScheduler SchedPolicyContext Running map[string]map[string]bool TasksRunningMutex sync.Mutex HostNameToSlaveID map[string]string // First set of PCP values are garbage values, signal to logger to start recording when we're // about to schedule a new task RecordPCP *bool // This channel is closed when the program receives an interrupt, // signalling that the program should shut down. Shutdown chan struct{} // This channel is closed after shutdown is closed, and only when all // outstanding tasks have been cleaned up. Done chan struct{} // Controls when to shutdown pcp logging. PCPLog chan struct{} // contains filtered or unexported fields }
func (*BaseScheduler) Disconnected ¶
func (s *BaseScheduler) Disconnected(sched.SchedulerDriver)
func (*BaseScheduler) Error ¶
func (s *BaseScheduler) Error(_ sched.SchedulerDriver, err string)
func (*BaseScheduler) ExecutorLost ¶
func (s *BaseScheduler) ExecutorLost(_ sched.SchedulerDriver, executorID *mesos.ExecutorID, slaveID *mesos.SlaveID, status int)
func (*BaseScheduler) FrameworkMessage ¶
func (s *BaseScheduler) FrameworkMessage( driver sched.SchedulerDriver, executorID *mesos.ExecutorID, slaveID *mesos.SlaveID, message string)
func (*BaseScheduler) Log ¶
func (s *BaseScheduler) Log(lmt elekLogDef.LogMessageType, msg string)
func (*BaseScheduler) LogClsfnAndTaskDistOverhead ¶
func (s *BaseScheduler) LogClsfnAndTaskDistOverhead(overhead time.Duration)
func (*BaseScheduler) LogCoLocatedTasks ¶
func (s *BaseScheduler) LogCoLocatedTasks(slaveID string)
func (*BaseScheduler) LogDisconnected ¶
func (s *BaseScheduler) LogDisconnected()
func (*BaseScheduler) LogElectronError ¶
func (s *BaseScheduler) LogElectronError(err error)
func (*BaseScheduler) LogExecutorLost ¶
func (s *BaseScheduler) LogExecutorLost(executorID *mesos.ExecutorID, slaveID *mesos.SlaveID)
func (*BaseScheduler) LogFrameworkMessage ¶
func (s *BaseScheduler) LogFrameworkMessage(executorID *mesos.ExecutorID, slaveID *mesos.SlaveID, message string)
func (*BaseScheduler) LogFrameworkRegistered ¶
func (s *BaseScheduler) LogFrameworkRegistered(frameworkID *mesos.FrameworkID, masterInfo *mesos.MasterInfo)
func (*BaseScheduler) LogFrameworkReregistered ¶
func (s *BaseScheduler) LogFrameworkReregistered(masterInfo *mesos.MasterInfo)
func (*BaseScheduler) LogInsufficientResourcesDeclineOffer ¶
func (s *BaseScheduler) LogInsufficientResourcesDeclineOffer(offer *mesos.Offer, offerResources ...interface{})
func (*BaseScheduler) LogMesosError ¶
func (s *BaseScheduler) LogMesosError(err string)
func (*BaseScheduler) LogNoPendingTasksDeclineOffers ¶
func (s *BaseScheduler) LogNoPendingTasksDeclineOffers(offer *mesos.Offer)
func (*BaseScheduler) LogNumberOfRunningTasks ¶
func (s *BaseScheduler) LogNumberOfRunningTasks()
func (*BaseScheduler) LogOfferRescinded ¶
func (s *BaseScheduler) LogOfferRescinded(offerID *mesos.OfferID)
func (*BaseScheduler) LogOffersReceived ¶
func (s *BaseScheduler) LogOffersReceived(offers []*mesos.Offer)
func (*BaseScheduler) LogSchedPolicySwitch ¶
func (s *BaseScheduler) LogSchedPolicySwitch(name string, nextPolicy SchedPolicyState)
func (*BaseScheduler) LogSchedTrace ¶
func (s *BaseScheduler) LogSchedTrace(taskToSchedule *mesos.TaskInfo, offer *mesos.Offer)
func (*BaseScheduler) LogSlaveLost ¶
func (s *BaseScheduler) LogSlaveLost(slaveID *mesos.SlaveID)
func (*BaseScheduler) LogTaskStarting ¶
func (s *BaseScheduler) LogTaskStarting(ts *def.Task, offer *mesos.Offer)
func (*BaseScheduler) LogTaskStatusUpdate ¶
func (s *BaseScheduler) LogTaskStatusUpdate(status *mesos.TaskStatus)
func (*BaseScheduler) LogTaskWattsConsideration ¶
func (s *BaseScheduler) LogTaskWattsConsideration(ts def.Task, host string, wattsToConsider float64)
func (*BaseScheduler) LogTerminateScheduler ¶
func (s *BaseScheduler) LogTerminateScheduler()
func (*BaseScheduler) OfferRescinded ¶
func (s *BaseScheduler) OfferRescinded(_ sched.SchedulerDriver, offerID *mesos.OfferID)
func (*BaseScheduler) Registered ¶
func (s *BaseScheduler) Registered( _ sched.SchedulerDriver, frameworkID *mesos.FrameworkID, masterInfo *mesos.MasterInfo)
func (*BaseScheduler) Reregistered ¶
func (s *BaseScheduler) Reregistered(_ sched.SchedulerDriver, masterInfo *mesos.MasterInfo)
func (*BaseScheduler) ResourceOffers ¶
func (s *BaseScheduler) ResourceOffers(driver sched.SchedulerDriver, offers []*mesos.Offer)
func (*BaseScheduler) SlaveLost ¶
func (s *BaseScheduler) SlaveLost(_ sched.SchedulerDriver, slaveID *mesos.SlaveID)
func (*BaseScheduler) StatusUpdate ¶
func (s *BaseScheduler) StatusUpdate(driver sched.SchedulerDriver, status *mesos.TaskStatus)
func (*BaseScheduler) SwitchSchedPol ¶
func (s *BaseScheduler) SwitchSchedPol(newSchedPol SchedPolicyState)
type BinPackSortedWatts ¶
type BinPackSortedWatts struct {
// contains filtered or unexported fields
}
func (*BinPackSortedWatts) ConsumeOffers ¶
func (s *BinPackSortedWatts) ConsumeOffers(spc SchedPolicyContext, driver sched.SchedulerDriver, offers []*mesos.Offer)
func (*BinPackSortedWatts) SwitchIfNecessary ¶
func (bsps *BinPackSortedWatts) SwitchIfNecessary(spc SchedPolicyContext)
func (*BinPackSortedWatts) UpdateLinks ¶
type ElectronScheduler ¶
type ElectronScheduler interface { sched.Scheduler // Pass the logMessageType and the logMessage to the loggers for logging. Log(logMType elekLogDef.LogMessageType, logMsg string) // To be called when about to launch a task. // Log message indicating that a task is about to start executing. // Also, log the host on which the task is going to be launched. LogTaskStarting(ts *def.Task, offer *mesos.Offer) // To be called when an offer is taken. // Log the chosen watts attribute for the task that has fit an offer. LogTaskWattsConsideration(ts def.Task, host string, wattsToConsider float64) // To be called when offers are received from Mesos. // Log the number of offers received and/or information about the received offers. LogOffersReceived(offers []*mesos.Offer) // To be called when a scheduling policy declines Mesos offers, as // there are no tasks pending to be scheduled. // Log the host information corresponding to the offers that were declined. LogNoPendingTasksDeclineOffers(offers *mesos.Offer) // Log the number of tasks that are currently executing on the cluster. LogNumberOfRunningTasks() // To be called when a task fits a Mesos offer. // Log information on the tasks that the new task is going to be coLocated with. // Uses the coLocated(...) utility in helpers.go. LogCoLocatedTasks(slaveID string) // Log the scheduled trace of task. // The schedTrace includes the TaskID and the hostname of the node // where is the task is going to be launched. LogSchedTrace(taskToSchedule *mesos.TaskInfo, offer *mesos.Offer) // To be called when all the tasks have completed executing. // Log message indicating that Electron has scheduled all the tasks. LogTerminateScheduler() // To be called when the offer is not consumed. // Log message to indicate that the offer had insufficient resources. LogInsufficientResourcesDeclineOffer(offer *mesos.Offer, offerResources ...interface{}) // To be called when offer is rescinded by Mesos. LogOfferRescinded(offerID *mesos.OfferID) // To be called when Mesos agent is lost LogSlaveLost(slaveID *mesos.SlaveID) // To be called when executor lost. LogExecutorLost(executorID *mesos.ExecutorID, slaveID *mesos.SlaveID) // Log a mesos error LogMesosError(err string) // Log an Electron error LogElectronError(err error) // Log Framework message LogFrameworkMessage(executorID *mesos.ExecutorID, slaveID *mesos.SlaveID, message string) // Log Framework has been registered LogFrameworkRegistered(frameworkID *mesos.FrameworkID, masterInfo *mesos.MasterInfo) // Log Framework has been re-registered LogFrameworkReregistered(masterInfo *mesos.MasterInfo) // Log Framework has been disconnected from the Mesos master LogDisconnected() // Log Status update of a task LogTaskStatusUpdate(status *mesos.TaskStatus) // Log Scheduling policy switches (if any) LogSchedPolicySwitch(name string, nextPolicy SchedPolicyState) // Log the computation overhead of classifying tasks in the scheduling window. LogClsfnAndTaskDistOverhead(overhead time.Duration) // contains filtered or unexported methods }
Implements mesos scheduler.
type FirstFit ¶
type FirstFit struct {
// contains filtered or unexported fields
}
Elektron scheduler implements the Scheduler interface.
func (*FirstFit) ConsumeOffers ¶
func (s *FirstFit) ConsumeOffers(spc SchedPolicyContext, driver sched.SchedulerDriver, offers []*mesos.Offer)
func (*FirstFit) SwitchIfNecessary ¶
func (bsps *FirstFit) SwitchIfNecessary(spc SchedPolicyContext)
func (*FirstFit) UpdateLinks ¶
type MaxGreedyMins ¶
type MaxGreedyMins struct {
// contains filtered or unexported fields
}
func (*MaxGreedyMins) CheckFit ¶
func (s *MaxGreedyMins) CheckFit( spc SchedPolicyContext, i int, task def.Task, wattsConsideration float64, offer *mesos.Offer, totalCPU *float64, totalRAM *float64, totalWatts *float64) (bool, *mesos.TaskInfo)
Determine if the remaining space inside of the offer is enough for this the task we need to create. If it is, create a TaskInfo and return it.
func (*MaxGreedyMins) ConsumeOffers ¶
func (s *MaxGreedyMins) ConsumeOffers(spc SchedPolicyContext, driver sched.SchedulerDriver, offers []*mesos.Offer)
func (*MaxGreedyMins) SwitchIfNecessary ¶
func (bsps *MaxGreedyMins) SwitchIfNecessary(spc SchedPolicyContext)
func (*MaxGreedyMins) UpdateLinks ¶
type MaxMin ¶
type MaxMin struct {
// contains filtered or unexported fields
}
func (*MaxMin) CheckFit ¶
func (s *MaxMin) CheckFit( spc SchedPolicyContext, i int, task def.Task, wattsConsideration float64, offer *mesos.Offer, totalCPU *float64, totalRAM *float64, totalWatts *float64) (bool, *mesos.TaskInfo)
Determine if the remaining space inside of the offer is enough for this task that we need to create. If it is, create a TaskInfo and return it.
func (*MaxMin) ConsumeOffers ¶
func (s *MaxMin) ConsumeOffers(spc SchedPolicyContext, driver sched.SchedulerDriver, offers []*mesos.Offer)
func (*MaxMin) SwitchIfNecessary ¶
func (bsps *MaxMin) SwitchIfNecessary(spc SchedPolicyContext)
func (*MaxMin) UpdateLinks ¶
type SchedPolicyContext ¶
type SchedPolicyContext interface { // Change the state of scheduling. SwitchSchedPol(s SchedPolicyState) }
type SchedPolicyState ¶
type SchedPolicyState interface { // Define the particular scheduling policy's methodology of resource offer consumption. ConsumeOffers(SchedPolicyContext, sched.SchedulerDriver, []*mesos.Offer) // Get information about the scheduling policy. GetInfo() (info struct { // contains filtered or unexported fields }) // Update links to next and previous scheduling policy. UpdateLinks(info struct { // contains filtered or unexported fields }) // Switch scheduling policy if necessary. SwitchIfNecessary(SchedPolicyContext) }
type SchedulerOptions ¶
type SchedulerOptions func(e ElectronScheduler) error
scheduler policy options to help initialize schedulers
func WithClassMapWatts ¶
func WithClassMapWatts(cmw bool) SchedulerOptions
func WithDone ¶
func WithDone(done chan struct{}) SchedulerOptions
func WithFixedSchedulingWindow ¶
func WithFixedSchedulingWindow(toFixSchedWindow bool, fixedSchedWindowSize int) SchedulerOptions
func WithLoggingChannels ¶
func WithLoggingChannels(lmt chan elekLogDef.LogMessageType, msg chan string) SchedulerOptions
func WithNameOfFirstSchedPolToFix ¶
func WithNameOfFirstSchedPolToFix(nameOfFirstSchedPol string) SchedulerOptions
func WithPCPLog ¶
func WithPCPLog(pcpLog chan struct{}) SchedulerOptions
func WithRecordPCP ¶
func WithRecordPCP(recordPCP *bool) SchedulerOptions
func WithSchedPolSwitchEnabled ¶
func WithSchedPolSwitchEnabled(enableSchedPolicySwitch bool, switchingCriteria string) SchedulerOptions
func WithSchedPolicy ¶
func WithSchedPolicy(schedPolicyName string) SchedulerOptions
func WithShutdown ¶
func WithShutdown(shutdown chan struct{}) SchedulerOptions
func WithTasks ¶
func WithTasks(ts []def.Task) SchedulerOptions
func WithWattsAsAResource ¶
func WithWattsAsAResource(waar bool) SchedulerOptions
Click to show internal directories.
Click to hide internal directories.