def

package
Version: v0.0.0-...-26f96f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SortByCPU   = func(task *Task) float64 { return task.CPU }
	SortByRAM   = func(task *Task) float64 { return task.RAM }
	SortByWatts = func(task *Task) float64 { return task.Watts }
)

Possible Sorting Criteria. Each holds a closure that fetches the required resource from the

given task reference.

Functions

func Compare

func Compare(task1 *Task, task2 *Task) bool

Compare two tasks.

func GetTaskDistributionInWindow

func GetTaskDistributionInWindow(windowSize int, tasks []Task) (float64, error)

Determine the distribution of light power consuming and heavy power consuming tasks in a given window.

func SortTasks

func SortTasks(ts []Task, sb SortBy)

Generic Task Sorter. Be able to sort an array of tasks based on any of the tasks' resources.

func WattsToConsider

func WattsToConsider(task Task, classMapWatts bool, offer *mesos.Offer) (float64, error)

Determine the watts value to consider for each task.

This value could either be task.Watts or task.ClassToWatts[<power class>] If task.ClassToWatts is not present, then return task.Watts (this would be for workloads which don't have classMapWatts).

Types

type Metric

type Metric struct {
	Name  string  `json:"name"`
	CPU   float64 `json:"cpu"`
	RAM   float64 `json:"ram"`
	Watts float64 `json:"watts"`
}

type SortBy

type SortBy func(task *Task) float64

the sortBy function that takes a task reference and returns the resource to consider when sorting.

type Task

type Task struct {
	Name         string             `json:"name"`
	CPU          float64            `json:"cpu"`
	RAM          float64            `json:"ram"`
	Watts        float64            `json:"watts"`
	Image        string             `json:"image"`
	CMD          string             `json:"cmd"`
	Instances    *int               `json:"inst"`
	Host         string             `json:"host"`
	TaskID       string             `json:"taskID"`
	ClassToWatts map[string]float64 `json:"class_to_watts"`
}

func TasksFromJSON

func TasksFromJSON(uri string) ([]Task, error)

func (*Task) SetTaskID

func (tsk *Task) SetTaskID(taskID string) bool

Set the taskID of the task.

func (*Task) UpdateHost

func (tsk *Task) UpdateHost(newHost string) bool

Update the host on which the task needs to be scheduled.

type TaskCluster

type TaskCluster struct {
	ClusterIndex int
	Tasks        []Task
	SizeScore    int // How many other clusters is this cluster bigger than
}

Information about a cluster of tasks.

func ClassifyTasks

func ClassifyTasks(tasks []Task, numberOfClusters int) []TaskCluster

type TaskResources

type TaskResources struct {
	CPU   float64
	Ram   float64
	Watts float64
}

Map taskIDs to resource requirements.

func GetResourceRequirement

func GetResourceRequirement(taskID string) (TaskResources, error)

Retrieve the resource requirement of a task specified by the TaskID

type TasksToClassify

type TasksToClassify []Task

Classification of Tasks using KMeans clustering using the watts consumption observations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL