Documentation ¶
Index ¶
- Variables
- func AssignmentIsScheduled(allocatedResources *sproto.ResourcesAllocated) bool
- func GetJobSubmissionTime(taskList *TaskList, jobID model.JobID) (time.Time, error)
- func InitializeQueuePosition(aTime time.Time, isK8s bool) decimal.Decimal
- func JobStats(taskList *TaskList) *jobv1.QueueStats
- func JobStatsByPool(taskList *TaskList, resourcePool string) *jobv1.QueueStats
- func ReduceToJobQInfo(reqs AllocReqs) map[model.JobID]*sproto.RMJobInfo
- func SortTasksWithPosition(taskList *TaskList, groups map[model.JobID]*Group, jobPositions JobSortState, ...) []*sproto.AllocateRequest
- type AllocReqs
- type Group
- type JobSortState
- type Registry
- type TaskIterator
- type TaskList
- func (l *TaskList) AddAllocation(id model.AllocationID, assigned *sproto.ResourcesAllocated)
- func (l *TaskList) AddAllocationRaw(id model.AllocationID, assigned *sproto.ResourcesAllocated)
- func (l *TaskList) AddTask(req *sproto.AllocateRequest) bool
- func (l *TaskList) Allocation(id model.AllocationID) *sproto.ResourcesAllocated
- func (l *TaskList) ForResourcePool(name string) *TaskList
- func (l *TaskList) IsScheduled(id model.AllocationID) bool
- func (l *TaskList) Iterator() *TaskIterator
- func (l *TaskList) Len() int
- func (l *TaskList) RemoveAllocation(id model.AllocationID)
- func (l *TaskList) RemoveTaskByID(id model.AllocationID) *sproto.AllocateRequest
- func (l *TaskList) TaskByID(id model.AllocationID) (*sproto.AllocateRequest, bool)
- func (l *TaskList) TaskSummaries(groups map[model.JobID]*Group, schedulerType string) map[model.AllocationID]sproto.AllocationSummary
- func (l *TaskList) TaskSummary(id model.AllocationID, groups map[model.JobID]*Group, schedulerType string) *sproto.AllocationSummary
Constants ¶
This section is empty.
Variables ¶
var GroupPriorityChangeRegistry = NewRegistry[model.JobID, func(int) error]()
GroupPriorityChangeRegistry is a registry of callbacks available for when a group's priority changes.
Functions ¶
func AssignmentIsScheduled ¶
func AssignmentIsScheduled(allocatedResources *sproto.ResourcesAllocated) bool
AssignmentIsScheduled determines if a resource allocation assignment is considered equivalent to being scheduled.
func GetJobSubmissionTime ¶
GetJobSubmissionTime returns the submission time for the first task found in the list for a job. we might RMs to have easier/faster access to this information than this.
func InitializeQueuePosition ¶
InitializeQueuePosition constructs a new queue position from time and RM type.
func JobStats ¶
func JobStats(taskList *TaskList) *jobv1.QueueStats
JobStats returns quick job-related stats about the TaskList.
func JobStatsByPool ¶
func JobStatsByPool(taskList *TaskList, resourcePool string) *jobv1.QueueStats
JobStatsByPool returns quick job-related stats about the TaskList, by resource pool.
func ReduceToJobQInfo ¶
ReduceToJobQInfo takes a list of AllocateRequest and reduces it to a summary of the Job Queue.
func SortTasksWithPosition ¶
func SortTasksWithPosition( taskList *TaskList, groups map[model.JobID]*Group, jobPositions JobSortState, k8s bool, ) []*sproto.AllocateRequest
SortTasksWithPosition returns a sorted view of the sproto.AllocateRequest's that make up the TaskList, sorted in priority order.
Types ¶
type AllocReqs ¶
type AllocReqs = []*sproto.AllocateRequest
AllocReqs is an alias for a list of Allocate Requests.
type Group ¶
Group manages the common state for a set of tasks that all share the same scheduling restrictions (e.g. max slots or fair share weight).
type JobSortState ¶
JobSortState models a job queue, and the positions of all jobs within it.
func InitializeJobSortState ¶
func InitializeJobSortState(isK8s bool) JobSortState
InitializeJobSortState constructs a JobSortState based on the RM type.
func (JobSortState) RecoverJobPosition ¶
func (j JobSortState) RecoverJobPosition(jobID model.JobID, position decimal.Decimal)
RecoverJobPosition explicitly sets the position of a job.
type Registry ¶
type Registry[K comparable, V any] struct { // contains filtered or unexported fields }
Registry is a thread-safe map of key value pairs that supports callbacks on delete.
func NewRegistry ¶
func NewRegistry[K comparable, V any]() *Registry[K, V]
NewRegistry creates a new Registry.
func (*Registry[K, V]) Add ¶
Add adds the given key value pair to the registry. If the key already exists, an error is returned.
func (*Registry[K, V]) Delete ¶
Delete deletes the given key from the registry. If the key does not exist, an error is returned.
func (*Registry[K, V]) Load ¶
Load returns the value stored for the given key and whether the key was found.
type TaskIterator ¶
type TaskIterator struct {
// contains filtered or unexported fields
}
TaskIterator is an iterator over some of AllocateRequests.
func (*TaskIterator) Next ¶
func (i *TaskIterator) Next() bool
Next moves the iterator forward to the next AllocateRequest.
func (*TaskIterator) Value ¶
func (i *TaskIterator) Value() *sproto.AllocateRequest
Value returns the AllocateRequest at the current position of the iterator.
type TaskList ¶
type TaskList struct {
// contains filtered or unexported fields
}
TaskList maintains all tasks in time order, and stores their allocation actor, active allocations and allocate requests.
func (*TaskList) AddAllocation ¶
func (l *TaskList) AddAllocation(id model.AllocationID, assigned *sproto.ResourcesAllocated)
AddAllocation adds an allocation for the allocation actor and updates the sproto.AllocateRequest's sproto.SchedulingState.
func (*TaskList) AddAllocationRaw ¶
func (l *TaskList) AddAllocationRaw(id model.AllocationID, assigned *sproto.ResourcesAllocated)
AddAllocationRaw adds an allocation for the allocation actor without modifying the sproto.AllocateRequest's sproto.SchedulingState.
func (*TaskList) AddTask ¶
func (l *TaskList) AddTask(req *sproto.AllocateRequest) bool
AddTask adds a task to the TaskList.
func (*TaskList) Allocation ¶
func (l *TaskList) Allocation(id model.AllocationID) *sproto.ResourcesAllocated
Allocation returns the allocation, or nil if there is none, for the allocation actor.
func (*TaskList) ForResourcePool ¶
ForResourcePool returns a new TaskList filtered by resource pool.
func (*TaskList) IsScheduled ¶
func (l *TaskList) IsScheduled(id model.AllocationID) bool
IsScheduled returns true if the allocation has resources.
func (*TaskList) Iterator ¶
func (l *TaskList) Iterator() *TaskIterator
Iterator returns a TaskIterator that traverses the TaskList by request time.
func (*TaskList) RemoveAllocation ¶
func (l *TaskList) RemoveAllocation(id model.AllocationID)
RemoveAllocation deletes any allocations for the allocation actor from the TaskList.
func (*TaskList) RemoveTaskByID ¶
func (l *TaskList) RemoveTaskByID(id model.AllocationID) *sproto.AllocateRequest
RemoveTaskByID deletes the task and its allocation, if any, from the TaskList.
func (*TaskList) TaskByID ¶
func (l *TaskList) TaskByID(id model.AllocationID) (*sproto.AllocateRequest, bool)
TaskByID returns the sproto.AllocateRequest for a task.
func (*TaskList) TaskSummaries ¶
func (l *TaskList) TaskSummaries( groups map[model.JobID]*Group, schedulerType string, ) map[model.AllocationID]sproto.AllocationSummary
TaskSummaries returns a summary of allocations for tasks in the TaskList.
func (*TaskList) TaskSummary ¶
func (l *TaskList) TaskSummary( id model.AllocationID, groups map[model.JobID]*Group, schedulerType string, ) *sproto.AllocationSummary
TaskSummary returns a summary for an allocation in the TaskList.