Documentation ¶
Index ¶
- Constants
- func AlternateTaskFinder(d distro.Distro) ([]task.Task, error)
- func DeficitBasedHostAllocator(ctx context.Context, hostAllocatorData HostAllocatorData) (int, error)
- func GetDistroQueueInfo(tasks []task.Task, maxDurationThreshold time.Duration) model.DistroQueueInfo
- func LegacyFindRunnableTasks(d distro.Distro) ([]task.Task, error)
- func ParallelTaskFinder(d distro.Distro) ([]task.Task, error)
- func PlanDistro(ctx context.Context, conf Configuration, s *evergreen.Settings) error
- func RunnableTasksPipeline(d distro.Distro) ([]task.Task, error)
- func SpawnHosts(ctx context.Context, d distro.Distro, newHostsNeeded int, ...) ([]host.Host, error)
- func UpdateStaticDistro(d distro.Distro) error
- func UtilizationBasedHostAllocator(ctx context.Context, hostAllocatorData HostAllocatorData) (int, error)
- type CmpBasedTaskComparator
- type CmpBasedTaskPrioritizer
- type CmpBasedTaskQueues
- type Configuration
- type DBTaskQueuePersister
- type HostAllocator
- type HostAllocatorData
- type Scheduler
- type TaskFinder
- type TaskGroupData
- type TaskPrioritizer
- type TaskQueuePersister
Constants ¶
const ( // maximum turnaround we want to maintain for all hosts for a given distro MaxDurationPerDistroHost = 30 * time.Minute MaxDurationPerDistroHostWithContainers = 2 * time.Minute )
const (
RunnerName = "scheduler"
)
Variables ¶
This section is empty.
Functions ¶
func DeficitBasedHostAllocator ¶
func DeficitBasedHostAllocator(ctx context.Context, hostAllocatorData HostAllocatorData) (int, error)
DeficitBasedHostAllocator decides how many new hosts are needed for a distro by seeing if the number of tasks that need to be run for the distro is greater than the number of hosts currently free to run a task. Returns a map of distro-># of hosts to spawn.
func GetDistroQueueInfo ¶
func GetDistroQueueInfo(tasks []task.Task, maxDurationThreshold time.Duration) model.DistroQueueInfo
Returns the distroQueueInfo for the given set of tasks having set the task.ExpectedDuration for each task.
func LegacyFindRunnableTasks ¶
The old Task finderDBTaskFinder, with the dependency check implemented in Go, instead of using $graphLookup
func PlanDistro ¶
func SpawnHosts ¶
func SpawnHosts(ctx context.Context, d distro.Distro, newHostsNeeded int, pool *evergreen.ContainerPool) ([]host.Host, error)
Call out to the embedded Manager to spawn hosts. Takes in a map of distro -> number of hosts to spawn for the distro. Returns a map of distro -> hosts spawned, and an error if one occurs.
func UpdateStaticDistro ¶
func UtilizationBasedHostAllocator ¶
func UtilizationBasedHostAllocator(ctx context.Context, hostAllocatorData HostAllocatorData) (int, error)
Types ¶
type CmpBasedTaskComparator ¶
type CmpBasedTaskComparator struct {
// contains filtered or unexported fields
}
CmpBasedTaskComparator runs the tasks through a slice of comparator functions determining which is more important.
func NewCmpBasedTaskComparator ¶
func NewCmpBasedTaskComparator(id string) *CmpBasedTaskComparator
NewCmpBasedTaskComparator returns a new task prioritizer, using the default set of comparators as well as the setup functions necessary for those comparators.
func (*CmpBasedTaskComparator) Len ¶
func (self *CmpBasedTaskComparator) Len() int
func (*CmpBasedTaskComparator) Less ¶
func (self *CmpBasedTaskComparator) Less(i, j int) bool
func (*CmpBasedTaskComparator) Swap ¶
func (self *CmpBasedTaskComparator) Swap(i, j int)
type CmpBasedTaskPrioritizer ¶
type CmpBasedTaskPrioritizer struct {
// contains filtered or unexported fields
}
func (*CmpBasedTaskPrioritizer) PrioritizeTasks ¶
func (prioritizer *CmpBasedTaskPrioritizer) PrioritizeTasks(distroId string, tasks []task.Task, versions map[string]model.Version) ([]task.Task, error)
PrioritizeTask prioritizes the tasks to run. First splits the tasks into slices based on whether they are part of patch versions or automatically created versions. Then prioritizes each slice, and merges them. Returns a full slice of the prioritized tasks, and an error if one occurs.
type CmpBasedTaskQueues ¶
type CmpBasedTaskQueues struct { HighPriorityTasks []task.Task PatchTasks []task.Task RepotrackerTasks []task.Task }
CmpBasedTaskQueues represents the three types of queues that are created for merging together into one queue. The HighPriorityTasks list represent the tasks that are always placed at the front of the queue PatchTasks and RepotrackerTasks are interleaved after the high priority tasks.
type Configuration ¶
type DBTaskQueuePersister ¶
type DBTaskQueuePersister struct{}
DBTaskQueuePersister saves a queue to the database.
func (*DBTaskQueuePersister) PersistTaskQueue ¶
func (self *DBTaskQueuePersister) PersistTaskQueue(distro string, tasks []task.Task, distroQueueInfo model.DistroQueueInfo) ([]model.TaskQueueItem, error)
PersistTaskQueue saves the task queue to the database. Returns an error if the db call returns an error.
type HostAllocator ¶
type HostAllocator func(context.Context, HostAllocatorData) (int, error)
HostAllocator is responsible for determining how many new hosts should be spun up.
func GetHostAllocator ¶
func GetHostAllocator(name string) HostAllocator
type HostAllocatorData ¶
type HostAllocatorData struct { Distro distro.Distro ExistingHosts []host.Host FreeHostFraction float64 UsesContainers bool ContainerPool *evergreen.ContainerPool DistroQueueInfo model.DistroQueueInfo }
type Scheduler ¶
type Scheduler struct { *evergreen.Settings TaskPrioritizer TaskQueuePersister HostAllocator FindRunnableTasks TaskFinder }
Responsible for prioritizing and scheduling tasks to be run, on a per-distro basis.
type TaskFinder ¶
func GetTaskFinder ¶
func GetTaskFinder(version string) TaskFinder
type TaskGroupData ¶
type TaskGroupData struct { Hosts []host.Host Info model.TaskGroupInfo }
type TaskPrioritizer ¶
type TaskPrioritizer interface { // Takes in a slice of tasks and the current MCI settings. // Returns the slice of tasks, sorted in the order in which they should // be run, as well as an error if appropriate. PrioritizeTasks(distroId string, tasks []task.Task, versions map[string]model.Version) ([]task.Task, error) }
TaskPrioritizer is responsible for taking in a slice of tasks, and ordering them according to which should be run first.
type TaskQueuePersister ¶
type TaskQueuePersister interface { // distro, tasks, duration cache PersistTaskQueue(string, []task.Task, model.DistroQueueInfo) ([]model.TaskQueueItem, error) }
TaskQueuePersister is responsible for taking a task queue for a particular distro and saving it.