Documentation ¶
Index ¶
- type GangSchedulingContext
- type JobSchedulingContext
- type PodSchedulingContext
- type QueueSchedulingContext
- func (qctx *QueueSchedulingContext) AddJobSchedulingContext(jctx *JobSchedulingContext) (bool, error)
- func (qctx *QueueSchedulingContext) ClearJobSpecs()
- func (qctx *QueueSchedulingContext) EvictJob(job interfaces.LegacySchedulerJob) (bool, error)
- func (qctx *QueueSchedulingContext) GetAllocation() schedulerobjects.ResourceList
- func (qctx *QueueSchedulingContext) GetWeight() float64
- func (qctx *QueueSchedulingContext) ReportString(verbosity int32) string
- func (qctx *QueueSchedulingContext) String() string
- type SchedulingContext
- func (sctx *SchedulingContext) AddGangSchedulingContext(gctx *GangSchedulingContext) (bool, error)
- func (sctx *SchedulingContext) AddJobSchedulingContext(jctx *JobSchedulingContext) (bool, error)
- func (sctx *SchedulingContext) AddQueueSchedulingContext(queue string, weight float64, ...) error
- func (sctx *SchedulingContext) AllocatedByQueueAndPriority() map[string]schedulerobjects.QuantityByTAndResourceType[string]
- func (sctx *SchedulingContext) ClearJobSpecs()
- func (sctx *SchedulingContext) ClearUnfeasibleSchedulingKeys()
- func (sctx *SchedulingContext) EvictGang(jobs []interfaces.LegacySchedulerJob) (bool, error)
- func (sctx *SchedulingContext) EvictJob(job interfaces.LegacySchedulerJob) (bool, error)
- func (sctx *SchedulingContext) GetQueue(queue string) (fairness.Queue, bool)
- func (sctx *SchedulingContext) ReportString(verbosity int32) string
- func (sctx *SchedulingContext) SchedulingKeyFromLegacySchedulerJob(job interfaces.LegacySchedulerJob) schedulerobjects.SchedulingKey
- func (sctx *SchedulingContext) String() string
- func (sctx *SchedulingContext) SuccessfulJobSchedulingContexts() []*JobSchedulingContext
- func (sctx *SchedulingContext) TotalCost() float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GangSchedulingContext ¶
type GangSchedulingContext struct { Created time.Time Queue string PriorityClassName string JobSchedulingContexts []*JobSchedulingContext TotalResourceRequests schedulerobjects.ResourceList AllJobsEvicted bool NodeUniformityLabel string GangMinCardinality int }
func NewGangSchedulingContext ¶
func NewGangSchedulingContext(jctxs []*JobSchedulingContext) *GangSchedulingContext
func (*GangSchedulingContext) Cardinality ¶ added in v0.3.92
func (gctx *GangSchedulingContext) Cardinality() int
Cardinality returns the number of jobs in the gang.
type JobSchedulingContext ¶
type JobSchedulingContext struct { // Time at which this context was created. Created time.Time // Id of the job this pod corresponds to. JobId string // Job spec. Job interfaces.LegacySchedulerJob // Scheduling requirements of this job. // We currently require that each job contains exactly one pod spec. PodRequirements *schedulerobjects.PodRequirements // Reason for why the job could not be scheduled. // Empty if the job was scheduled successfully. UnschedulableReason string // Pod scheduling contexts for the individual pods that make up the job. PodSchedulingContext *PodSchedulingContext // The minimum size of the gang associated with this job. GangMinCardinality int // If set, indicates this job should be failed back to the client when the gang is scheduled. ShouldFail bool }
JobSchedulingContext is created by the scheduler and contains information about the decision made by the scheduler for a particular job.
func JobSchedulingContextsFromJobs ¶ added in v0.3.78
func JobSchedulingContextsFromJobs[J interfaces.LegacySchedulerJob](priorityClasses map[string]types.PriorityClass, jobs []J, extractGangInfo func(map[string]string) (string, int, int, bool, error)) []*JobSchedulingContext
func (*JobSchedulingContext) IsSuccessful ¶
func (jctx *JobSchedulingContext) IsSuccessful() bool
func (*JobSchedulingContext) String ¶
func (jctx *JobSchedulingContext) String() string
type PodSchedulingContext ¶
type PodSchedulingContext struct { // Time at which this context was created. Created time.Time // ID of the node that the pod was assigned to, or empty. NodeId string // Score indicates how well the pod fits on the selected node. Score int // Priority class priority at which this pod was scheduled. // Only set if NodeId is. ScheduledAtPriority int32 // Node types on which this pod could be scheduled. MatchingNodeTypes []*schedulerobjects.NodeType // Total number of nodes in the cluster when trying to schedule. NumNodes int // Number of nodes excluded by reason. NumExcludedNodesByReason map[string]int }
PodSchedulingContext is returned by SelectAndBindNodeToPod and contains detailed information on the scheduling decision made for this pod.
func (*PodSchedulingContext) String ¶
func (pctx *PodSchedulingContext) String() string
type QueueSchedulingContext ¶
type QueueSchedulingContext struct { // The scheduling context to which this QueueSchedulingContext belongs. SchedulingContext *SchedulingContext // Time at which this context was created. Created time.Time // Executor this job was attempted to be assigned to. ExecutorId string // Queue name. Queue string // Determines the fair share of this queue relative to other queues. Weight float64 // Limits job scheduling rate for this queue. // Use the "Started" time to ensure limiter state remains constant within each scheduling round. Limiter *rate.Limiter // Total resources assigned to the queue across all clusters by priority class priority. // Includes jobs scheduled during this invocation of the scheduler. Allocated schedulerobjects.ResourceList // Total resources assigned to the queue across all clusters by priority class. // Includes jobs scheduled during this invocation of the scheduler. AllocatedByPriorityClass schedulerobjects.QuantityByTAndResourceType[string] // Resources assigned to this queue during this scheduling cycle. ScheduledResourcesByPriorityClass schedulerobjects.QuantityByTAndResourceType[string] // Resources evicted from this queue during this scheduling cycle. EvictedResourcesByPriorityClass schedulerobjects.QuantityByTAndResourceType[string] // Job scheduling contexts associated with successful scheduling attempts. SuccessfulJobSchedulingContexts map[string]*JobSchedulingContext // Job scheduling contexts associated with unsuccessful scheduling attempts. UnsuccessfulJobSchedulingContexts map[string]*JobSchedulingContext // Jobs evicted in this round. EvictedJobsById map[string]bool }
QueueSchedulingContext captures the decisions made by the scheduler during one invocation for a particular queue.
func (*QueueSchedulingContext) AddJobSchedulingContext ¶
func (qctx *QueueSchedulingContext) AddJobSchedulingContext(jctx *JobSchedulingContext) (bool, error)
AddJobSchedulingContext adds a job scheduling context. Automatically updates scheduled resources.
func (*QueueSchedulingContext) ClearJobSpecs ¶
func (qctx *QueueSchedulingContext) ClearJobSpecs()
ClearJobSpecs zeroes out job specs to reduce memory usage.
func (*QueueSchedulingContext) EvictJob ¶
func (qctx *QueueSchedulingContext) EvictJob(job interfaces.LegacySchedulerJob) (bool, error)
func (*QueueSchedulingContext) GetAllocation ¶ added in v0.3.90
func (qctx *QueueSchedulingContext) GetAllocation() schedulerobjects.ResourceList
GetAllocation is necessary to implement the fairness.Queue interface.
func (*QueueSchedulingContext) GetWeight ¶ added in v0.3.90
func (qctx *QueueSchedulingContext) GetWeight() float64
GetWeight is necessary to implement the fairness.Queue interface.
func (*QueueSchedulingContext) ReportString ¶ added in v0.3.71
func (qctx *QueueSchedulingContext) ReportString(verbosity int32) string
func (*QueueSchedulingContext) String ¶
func (qctx *QueueSchedulingContext) String() string
type SchedulingContext ¶
type SchedulingContext struct { // Time at which the scheduling cycle started. Started time.Time // Time at which the scheduling cycle finished. Finished time.Time // Executor for which we're currently scheduling jobs. ExecutorId string // Resource pool of this executor. Pool string // Allowed priority classes. PriorityClasses map[string]types.PriorityClass // Default priority class. DefaultPriorityClass string // Determines how fairness is computed. FairnessCostProvider fairness.FairnessCostProvider // Limits job scheduling rate globally across all queues. // Use the "Started" time to ensure limiter state remains constant within each scheduling round. Limiter *rate.Limiter // Sum of queue weights across all queues. WeightSum float64 // Per-queue scheduling contexts. QueueSchedulingContexts map[string]*QueueSchedulingContext // Total resources across all clusters available at the start of the scheduling cycle. TotalResources schedulerobjects.ResourceList // Resources assigned across all queues during this scheduling cycle. ScheduledResources schedulerobjects.ResourceList ScheduledResourcesByPriorityClass schedulerobjects.QuantityByTAndResourceType[string] // Resources evicted across all queues during this scheduling cycle. EvictedResources schedulerobjects.ResourceList EvictedResourcesByPriorityClass schedulerobjects.QuantityByTAndResourceType[string] // Total number of successfully scheduled jobs. NumScheduledJobs int // Total number of successfully scheduled gangs. NumScheduledGangs int // Total number of evicted jobs. NumEvictedJobs int // TODO(reports): Count the number of evicted gangs. // Reason for why the scheduling round finished. TerminationReason string // Used to efficiently generate scheduling keys. SchedulingKeyGenerator *schedulerobjects.SchedulingKeyGenerator // Record of job scheduling requirements known to be unfeasible. // Used to immediately reject new jobs with identical reqirements. // Maps to the JobSchedulingContext of a previous job attempted to schedule with the same key. UnfeasibleSchedulingKeys map[schedulerobjects.SchedulingKey]*JobSchedulingContext }
SchedulingContext contains information necessary for scheduling and records what happened in a scheduling round.
func GetSchedulingContextFromQueueSchedulingContext ¶ added in v0.3.71
func GetSchedulingContextFromQueueSchedulingContext(qctx *QueueSchedulingContext) *SchedulingContext
func NewSchedulingContext ¶
func NewSchedulingContext( executorId string, pool string, priorityClasses map[string]types.PriorityClass, defaultPriorityClass string, fairnessCostProvider fairness.FairnessCostProvider, limiter *rate.Limiter, totalResources schedulerobjects.ResourceList, ) *SchedulingContext
func (*SchedulingContext) AddGangSchedulingContext ¶
func (sctx *SchedulingContext) AddGangSchedulingContext(gctx *GangSchedulingContext) (bool, error)
func (*SchedulingContext) AddJobSchedulingContext ¶
func (sctx *SchedulingContext) AddJobSchedulingContext(jctx *JobSchedulingContext) (bool, error)
AddJobSchedulingContext adds a job scheduling context. Automatically updates scheduled resources.
func (*SchedulingContext) AddQueueSchedulingContext ¶ added in v0.3.68
func (sctx *SchedulingContext) AddQueueSchedulingContext( queue string, weight float64, initialAllocatedByPriorityClass schedulerobjects.QuantityByTAndResourceType[string], limiter *rate.Limiter, ) error
func (*SchedulingContext) AllocatedByQueueAndPriority ¶
func (sctx *SchedulingContext) AllocatedByQueueAndPriority() map[string]schedulerobjects.QuantityByTAndResourceType[string]
AllocatedByQueueAndPriority returns map from queue name and priority to resources allocated.
func (*SchedulingContext) ClearJobSpecs ¶
func (sctx *SchedulingContext) ClearJobSpecs()
ClearJobSpecs zeroes out job specs to reduce memory usage.
func (*SchedulingContext) ClearUnfeasibleSchedulingKeys ¶ added in v0.3.68
func (sctx *SchedulingContext) ClearUnfeasibleSchedulingKeys()
func (*SchedulingContext) EvictGang ¶
func (sctx *SchedulingContext) EvictGang(jobs []interfaces.LegacySchedulerJob) (bool, error)
func (*SchedulingContext) EvictJob ¶
func (sctx *SchedulingContext) EvictJob(job interfaces.LegacySchedulerJob) (bool, error)
func (*SchedulingContext) GetQueue ¶ added in v0.3.90
func (sctx *SchedulingContext) GetQueue(queue string) (fairness.Queue, bool)
GetQueue is necessary to implement the fairness.QueueRepository interface.
func (*SchedulingContext) ReportString ¶ added in v0.3.71
func (sctx *SchedulingContext) ReportString(verbosity int32) string
func (*SchedulingContext) SchedulingKeyFromLegacySchedulerJob ¶ added in v0.3.71
func (sctx *SchedulingContext) SchedulingKeyFromLegacySchedulerJob(job interfaces.LegacySchedulerJob) schedulerobjects.SchedulingKey
func (*SchedulingContext) String ¶
func (sctx *SchedulingContext) String() string
func (*SchedulingContext) SuccessfulJobSchedulingContexts ¶
func (sctx *SchedulingContext) SuccessfulJobSchedulingContexts() []*JobSchedulingContext
func (*SchedulingContext) TotalCost ¶ added in v0.3.78
func (sctx *SchedulingContext) TotalCost() float64
TotalCost returns the sum of the costs across all queues.