Documentation ¶
Index ¶
- func AssignmentsToPluginsTasks(assignments []*Assignment) []plugins.Task
- func AssignmentsToTasks(assignments []*Assignment) []models.Task
- func HostOffersToOffers(offers []*HostOffers) []models.Offer
- type Assignment
- func (a *Assignment) Fits(resLeft scalar.Resources, portsLeft uint64) (scalar.Resources, uint64, bool)
- func (a *Assignment) GetPlacement() models.Offer
- func (a *Assignment) GetPlacementFailure() string
- func (a *Assignment) GetPlacementNeeds() plugins.PlacementNeeds
- func (a *Assignment) GetResmgrTaskV0() *resmgr.Task
- func (a *Assignment) GetTask() *TaskV0
- func (a *Assignment) IncRounds()
- func (a *Assignment) IsPastDeadline(now time.Time) bool
- func (a *Assignment) IsPastMaxRounds() bool
- func (a *Assignment) IsReadyForHostReservation() bool
- func (a *Assignment) IsRevocable() bool
- func (a *Assignment) NeedsSpread() bool
- func (a *Assignment) OrchestrationID() string
- func (a *Assignment) PelotonID() string
- func (a *Assignment) PreferredHost() string
- func (a *Assignment) SetPlacement(offer models.Offer)
- func (a *Assignment) SetPlacementFailure(failureReason string)
- func (a *Assignment) SetTask(task *TaskV0)
- func (a *Assignment) ToMimirEntity() *placement.Entity
- type Host
- type HostOffers
- func (host *HostOffers) Age(now time.Time) time.Duration
- func (host *HostOffers) AgentID() string
- func (host *HostOffers) AvailablePortRanges() map[*models.PortRange]struct{}
- func (host *HostOffers) Data() interface{}
- func (host *HostOffers) GetAvailablePortCount() uint64
- func (host *HostOffers) GetAvailableResources() (scalar.Resources, uint64)
- func (host *HostOffers) GetOffer() *hostsvc.HostOffer
- func (host *HostOffers) GetTasks() []*resmgr.Task
- func (host *HostOffers) Hostname() string
- func (host *HostOffers) ID() string
- func (host *HostOffers) SetData(data interface{})
- func (o *HostOffers) ToMimirGroup() *placement.Group
- type TaskV0
- func (task *TaskV0) Data() interface{}
- func (task *TaskV0) GetDeadline() time.Time
- func (task *TaskV0) GetGang() *resmgrsvc.Gang
- func (task *TaskV0) GetMaxRounds() int
- func (task *TaskV0) GetRounds() int
- func (task *TaskV0) GetTask() *resmgr.Task
- func (task *TaskV0) IncRounds()
- func (task *TaskV0) PastDeadline(now time.Time) bool
- func (task *TaskV0) PastDesiredHostPlacementDeadline(now time.Time) bool
- func (task *TaskV0) PastMaxRounds() bool
- func (task *TaskV0) SetData(data interface{})
- func (task *TaskV0) SetDeadline(deadline time.Time)
- func (task *TaskV0) SetGang(gang *resmgrsvc.Gang)
- func (task *TaskV0) SetMaxRounds(maxRounds int)
- func (task *TaskV0) SetRounds(rounds int)
- func (task *TaskV0) SetTask(resmgrTask *resmgr.Task)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignmentsToPluginsTasks ¶
func AssignmentsToPluginsTasks(assignments []*Assignment) []plugins.Task
AssignmentsToPluginsTasks converts a slice of assignments into a slice of tasks for plugin use.
func AssignmentsToTasks ¶
func AssignmentsToTasks(assignments []*Assignment) []models.Task
AssignmentsToTasks converts a slice of assignments into a slice of Tasks.
func HostOffersToOffers ¶
func HostOffersToOffers(offers []*HostOffers) []models.Offer
HostOffersToOffers converts a slice of HostOffers into a slice of Offers.
Types ¶
type Assignment ¶
type Assignment struct { Task *TaskV0 `json:"task"` Offer models.Offer `json:"host"` PlacementFailure string }
Assignment represents the assignment of a task to a host. One host can be used in multiple assignments.
func NewAssignment ¶
func NewAssignment(task *TaskV0) *Assignment
NewAssignment will create a new empty assignment from a task.
func (*Assignment) Fits ¶
func (a *Assignment) Fits( resLeft scalar.Resources, portsLeft uint64, ) (scalar.Resources, uint64, bool)
Fits returns true if the given resources fit in the assignment.
func (*Assignment) GetPlacement ¶
func (a *Assignment) GetPlacement() models.Offer
GetPlacement returns the matching offer of this task.
func (*Assignment) GetPlacementFailure ¶
func (a *Assignment) GetPlacementFailure() string
GetPlacementFailure returns the reason why the assignment was unsuccessful
func (*Assignment) GetPlacementNeeds ¶
func (a *Assignment) GetPlacementNeeds() plugins.PlacementNeeds
GetPlacementNeeds returns the placement needs of this task.
func (*Assignment) GetResmgrTaskV0 ¶
func (a *Assignment) GetResmgrTaskV0() *resmgr.Task
GetResmgrTaskV0 returns the resource manager task for this assignment.
func (*Assignment) GetTask ¶
func (a *Assignment) GetTask() *TaskV0
GetTask returns the task of the assignment.
func (*Assignment) IncRounds ¶
func (a *Assignment) IncRounds()
IncRounds increments the internal count of placement rounds.
func (*Assignment) IsPastDeadline ¶
func (a *Assignment) IsPastDeadline(now time.Time) bool
IsPastDeadline returns true if the task is past its placement deadline. Additionally, if the task has a preferred host and is past its host placement deadline, it will also return true.
func (*Assignment) IsPastMaxRounds ¶
func (a *Assignment) IsPastMaxRounds() bool
IsPastMaxRounds returns true if the task has been through too many placement rounds.
func (*Assignment) IsReadyForHostReservation ¶
func (a *Assignment) IsReadyForHostReservation() bool
IsReadyForHostReservation returns true if this task is ready for host reservation.
func (*Assignment) IsRevocable ¶
func (a *Assignment) IsRevocable() bool
IsRevocable returns true if the task should run on revocable resources.
func (*Assignment) NeedsSpread ¶
func (a *Assignment) NeedsSpread() bool
NeedsSpread returns whether this task was asked to be spread onto the hosts in its gang.
func (*Assignment) OrchestrationID ¶
func (a *Assignment) OrchestrationID() string
OrchestrationID returns the mesos task ID or pod name.
func (*Assignment) PelotonID ¶
func (a *Assignment) PelotonID() string
PelotonID returns the peloton id of the task that the assignment represents.
func (*Assignment) PreferredHost ¶
func (a *Assignment) PreferredHost() string
PreferredHost returns the host preference for this task.
func (*Assignment) SetPlacement ¶
func (a *Assignment) SetPlacement(offer models.Offer)
SetPlacement sets the matching offer of this task.
func (*Assignment) SetPlacementFailure ¶
func (a *Assignment) SetPlacementFailure(failureReason string)
SetPlacementFailure sets the reason for the failed assignment
func (*Assignment) SetTask ¶
func (a *Assignment) SetTask(task *TaskV0)
SetTask sets the task in the assignment to the given task.
func (*Assignment) ToMimirEntity ¶
func (a *Assignment) ToMimirEntity() *placement.Entity
ToMimirEntity converts the assignment into a mimir entity.
type Host ¶
type Host struct { // host info from host manager Host *hostsvc.HostInfo `json:"hostinfo"` // tasks running on the host. Tasks []*resmgr.Task `json:"tasks"` // contains filtered or unexported fields }
Host represents a Peloton hostinfo from hostmanager and the tasks running on it.
func NewHosts ¶
NewHosts will create a placement host from a host manager host and all the resource manager tasks on it.
type HostOffers ¶
type HostOffers struct { // host offer of the host. Offer *hostsvc.HostOffer `json:"offer"` // tasks running on the host. Tasks []*resmgr.Task `json:"tasks"` // Claimed is the time when the host was acquired from the host manager. Claimed time.Time `json:"claimed"` // contains filtered or unexported fields }
HostOffers represents a Peloton host and the tasks running on it and a Mimir placement group also be obtained from it.
func NewHostOffers ¶
func NewHostOffers(hostOffer *hostsvc.HostOffer, tasks []*resmgr.Task, claimed time.Time) *HostOffers
NewHostOffers will create a placement host from a host manager host and all the resource manager tasks on it.
func (*HostOffers) Age ¶
func (host *HostOffers) Age(now time.Time) time.Duration
Age will return the age of the host, which is the time since it was dequeued from the host manager.
func (*HostOffers) AgentID ¶
func (host *HostOffers) AgentID() string
AgentID returns the AgentID of this offer.
func (*HostOffers) AvailablePortRanges ¶
func (host *HostOffers) AvailablePortRanges() map[*models.PortRange]struct{}
AvailablePortRanges returns the available port ranges.
func (*HostOffers) Data ¶
func (host *HostOffers) Data() interface{}
Data will return the data transfer object of the host.
func (*HostOffers) GetAvailablePortCount ¶
func (host *HostOffers) GetAvailablePortCount() uint64
GetAvailablePortCount returns the total number of ports available in this host's offers.
func (*HostOffers) GetAvailableResources ¶
func (host *HostOffers) GetAvailableResources() (scalar.Resources, uint64)
GetAvailableResources returns the available resources of this host offer.
func (*HostOffers) GetOffer ¶
func (host *HostOffers) GetOffer() *hostsvc.HostOffer
GetOffer returns the host offer of the host.
func (*HostOffers) GetTasks ¶
func (host *HostOffers) GetTasks() []*resmgr.Task
GetTasks returns the tasks of the host.
func (*HostOffers) Hostname ¶
func (host *HostOffers) Hostname() string
Hostname returns the hostname that this offer belongs to.
func (*HostOffers) SetData ¶
func (host *HostOffers) SetData(data interface{})
SetData will set the data transfer object on the host.
func (*HostOffers) ToMimirGroup ¶
func (o *HostOffers) ToMimirGroup() *placement.Group
ToMimirGroup converts the HostOffers object into a mimir group.
type TaskV0 ¶
type TaskV0 struct { Gang *resmgrsvc.Gang `json:"gang"` Task *resmgr.Task `json:"task"` // Deadline when the task should successfully placed or have failed to do so. Deadline time.Time `json:"deadline"` // MaxRounds is the maximal number of successful placement Rounds. MaxRounds int `json:"max_rounds"` // Rounds is the current number of successful placement Rounds. Rounds int `json:"rounds"` // PlacementDeadline when the task should successfully placed // on the desired host or have failed to do so. PlacementDeadline time.Time `json:"placement_deadline"` // contains filtered or unexported fields }
TaskV0 represents a Placement task, a Mimir placement entity can also be obtained from it.
func NewTask ¶
func NewTask( gang *resmgrsvc.Gang, task *resmgr.Task, deadline time.Time, placementDeadline time.Time, maxRounds int) *TaskV0
NewTask will create a new placement task from a resource manager task, and the gang it belongs to.
func (*TaskV0) Data ¶
func (task *TaskV0) Data() interface{}
Data will return the data transfer object of the task.
func (*TaskV0) GetDeadline ¶
GetDeadline returns the deadline of the task.
func (*TaskV0) GetMaxRounds ¶
GetMaxRounds returns the max rounds of the task.
func (*TaskV0) IncRounds ¶
func (task *TaskV0) IncRounds()
IncRounds will increment the number of placement rounds that the task have been through.
func (*TaskV0) PastDeadline ¶
PastDeadline will return true iff the deadline for the gang has passed.
func (*TaskV0) PastDesiredHostPlacementDeadline ¶
PastDesiredHostPlacementDeadline returns true iff the deadline for placing the task onto its desired host has passed.
func (*TaskV0) PastMaxRounds ¶
PastMaxRounds returns true iff the task has gone through its maximal number of placement rounds.
func (*TaskV0) SetData ¶
func (task *TaskV0) SetData(data interface{})
SetData will set the data transfer object on the task.
func (*TaskV0) SetDeadline ¶
SetDeadline sets the deadline of the task.
func (*TaskV0) SetMaxRounds ¶
SetMaxRounds sets the max rounds of the task.