scheduling

package
v0.3.20 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregateNodeTypeAllocations added in v0.1.14

func AggregateNodeTypeAllocations(nodes []api.NodeInfo) []*nodeTypeAllocation

func CalculatePriorityUpdate added in v0.1.25

func CalculatePriorityUpdate(resourceScarcity map[string]float64, previousReport *api.ClusterUsageReport, report *api.ClusterUsageReport, previousPriority map[string]float64, halfTime time.Duration) map[string]float64

func CalculateQueuesPriorityInfo

func CalculateQueuesPriorityInfo(clusterPriorities map[string]map[string]float64, activeClusterReports map[string]*api.ClusterUsageReport, queues []*api.Queue) map[*api.Queue]QueuePriorityInfo

func CombineLeasedReportResourceByQueue added in v0.1.6

func CombineLeasedReportResourceByQueue(reports map[string]*api.ClusterLeasedReport) map[string]common.ComputeResources

func CreateClusterLeasedReport added in v0.1.6

func CreateClusterLeasedReport(clusterId string, currentReport *api.ClusterLeasedReport, additionallyLeasedJobs []*api.Job) *api.ClusterLeasedReport

func CreateClusterSchedulingInfoReport added in v0.1.6

func CreateClusterSchedulingInfoReport(leaseRequest *api.LeaseRequest, nodeAllocations []*nodeTypeAllocation) *api.ClusterSchedulingInfoReport

func FilterActiveClusterSchedulingInfoReports added in v0.1.6

func FilterActiveClusterSchedulingInfoReports(reports map[string]*api.ClusterSchedulingInfoReport) map[string]*api.ClusterSchedulingInfoReport

FilterActiveClusterSchedulingInfoReports returns the subset of reports within the expiry time.

func FilterActiveClusters

func FilterActiveClusters(reports map[string]*api.ClusterUsageReport) map[string]*api.ClusterUsageReport

FilterActiveClusters returns the subset of reports corresponding to active clusters. A cluster is considered active if the most recent ClusterUsageReport was received less than activeClusterExpiry ago.

func FilterClusterLeasedReports added in v0.1.25

func FilterClusterLeasedReports(ids []string, reports map[string]*api.ClusterLeasedReport) map[string]*api.ClusterLeasedReport

FilterClusterLeasedReports returns the subset of reports with id in the provided slice of ids. ids for which there is no corresponding report are ignored.

func FilterPoolClusters added in v0.1.24

func FilterPoolClusters(pool string, reports map[string]*api.ClusterUsageReport) map[string]*api.ClusterUsageReport

FilterPoolClusters returns the subset of reports for which the pool has a specific value.

func GetClusterReportIds

func GetClusterReportIds(reports map[string]*api.ClusterUsageReport) []string

GetClusterReportIds returns a slice composed of all unique report ids in the provided map.

func GroupByPool added in v0.1.24

func GroupByPool(reports map[string]*api.ClusterUsageReport) map[string]map[string]*api.ClusterUsageReport

GroupByPool returns a map from pool name to another map, which in turn maps report ids to reports.

func GroupSchedulingInfoByPool added in v0.1.24

func GroupSchedulingInfoByPool(reports map[string]*api.ClusterSchedulingInfoReport) map[string]map[string]*api.ClusterSchedulingInfoReport

GroupSchedulingInfoByPool returns a map from pool name to another map, which in turn maps report ids to reports.

func LeaseJobs added in v0.1.2

func LeaseJobs(ctx context.Context,
	config *configuration.SchedulingConfig,
	jobQueue JobQueue,
	onJobLease func([]*api.Job),
	request *api.LeaseRequest,
	nodeResources []*nodeTypeAllocation,
	activeClusterReports map[string]*api.ClusterUsageReport,
	activeClusterLeaseJobReports map[string]*api.ClusterLeasedReport,
	clusterPriorities map[string]map[string]float64,
	activeQueues []*api.Queue) ([]*api.Job, error)

func MatchSchedulingRequirements added in v0.1.6

func MatchSchedulingRequirements(job *api.Job, schedulingInfo *api.ClusterSchedulingInfoReport) (bool, error)

func MatchSchedulingRequirementsOnAnyCluster added in v0.1.24

func MatchSchedulingRequirementsOnAnyCluster(job *api.Job, allClusterSchedulingInfos map[string]*api.ClusterSchedulingInfoReport) (bool, error)

MatchSchedulingRequirementsOnAnyCluster returns true if the provided job can be scheduled. If returning false, the reason for not being able to schedule the pod is indicated by the returned error, which is of type *armadaerrors.ErrPodUnschedulable.

func QueueSlicesToShares added in v0.1.2

func QueueSlicesToShares(resourceScarcity map[string]float64, schedulingInfo map[*api.Queue]*QueueSchedulingInfo) map[*api.Queue]float64

func ResourceScarcityFromReports

func ResourceScarcityFromReports(reports map[string]*api.ClusterUsageReport) map[string]float64

func ResourcesAsUsage

func ResourcesAsUsage(resourceScarcity map[string]float64, resources common.ComputeResources) float64

func ResourcesFloatAsUsage

func ResourcesFloatAsUsage(resourceScarcity map[string]float64, resources common.ComputeResourcesFloat) float64

func SliceResourceWithLimits added in v0.1.6

func SliceResourceWithLimits(resourceScarcity map[string]float64, queueSchedulingInfo map[*api.Queue]*QueueSchedulingInfo, queuePriorities map[*api.Queue]QueuePriorityInfo, quantityToSlice common.ComputeResourcesFloat) map[*api.Queue]*QueueSchedulingInfo

func SumRemainingResource added in v0.1.6

func SumRemainingResource(schedulingInfo map[*api.Queue]*QueueSchedulingInfo) common.ComputeResourcesFloat

Types

type JobQueue added in v0.1.26

type JobQueue interface {
	PeekClusterQueue(clusterId, queue string, limit int64) ([]*api.Job, error)
	TryLeaseJobs(clusterId string, queue string, jobs []*api.Job) ([]*api.Job, error)
}

type LeaseManager added in v0.1.0

type LeaseManager struct {
	// contains filtered or unexported fields
}

func NewLeaseManager added in v0.1.0

func NewLeaseManager(
	jobRepository repository.JobRepository,
	queueRepository repository.QueueRepository,
	eventStore repository.EventStore,
	leaseExpiryDuration time.Duration) *LeaseManager

func (*LeaseManager) ExpireLeases added in v0.1.0

func (l *LeaseManager) ExpireLeases()

type LeasePayloadLimit added in v0.2.15

type LeasePayloadLimit struct {
	// contains filtered or unexported fields
}

func NewLeasePayloadLimit added in v0.2.15

func NewLeasePayloadLimit(numberOfJobsLimit int, payloadSizeLimitBytes int, maxExpectedJobSizeBytes int) LeasePayloadLimit

NewLeasePayloadLimit numberOfJobsLimit - This is the maximum number of jobs per lease payload payloadSizeLimitBytes - This is the maximum size of all the Jobs in the lease payload in bytes maxExpectedJobSizeBytes - This is the maximum expected job size in bytes

It is used as a threshold to determine when adding more jobs would exceed payloadSizeLimitBytes

func (*LeasePayloadLimit) AtLimit added in v0.2.15

func (s *LeasePayloadLimit) AtLimit() bool

AtLimit

This returns true when:
- remainingJobCount <= 0
- remainingPayloadSizeLimitBytes <= maxExpectedJobSizeBytes
  If we have less bytes left than the maximum job size, we should consider ourselves at the limit

func (*LeasePayloadLimit) IsWithinLimit added in v0.2.15

func (s *LeasePayloadLimit) IsWithinLimit(job *api.Job) bool

func (*LeasePayloadLimit) RemoveFromRemainingLimit added in v0.2.15

func (s *LeasePayloadLimit) RemoveFromRemainingLimit(jobs ...*api.Job)

type PodMatchingContext added in v0.2.6

type PodMatchingContext struct {
	// contains filtered or unexported fields
}

func NewPodMatchingContext added in v0.2.6

func NewPodMatchingContext(podSpec *v1.PodSpec) *PodMatchingContext

func (*PodMatchingContext) Matches added in v0.2.6

func (podCtx *PodMatchingContext) Matches(nodeType *api.NodeType, availableResources common.ComputeResourcesFloat) (bool, error)

type QueuePriorityInfo

type QueuePriorityInfo struct {
	Priority     float64
	CurrentUsage common.ComputeResources
}

type QueueSchedulingInfo added in v0.1.6

type QueueSchedulingInfo struct {
	// contains filtered or unexported fields
}

func NewQueueSchedulingInfo added in v0.1.6

func NewQueueSchedulingInfo(
	remainingSchedulingLimit common.ComputeResourcesFloat,
	schedulingShare common.ComputeResourcesFloat,
	adjustedShare common.ComputeResourcesFloat) *QueueSchedulingInfo

func (*QueueSchedulingInfo) UpdateLimits added in v0.1.6

func (info *QueueSchedulingInfo) UpdateLimits(resourceUsed common.ComputeResourcesFloat)

Jump to

Keyboard shortcuts

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