Documentation ¶
Index ¶
- func SchedulingOrderCompare(job, other *Job) int
- type Job
- func (job *Job) AllRuns() []*JobRun
- func (job *Job) CancelByJobsetRequested() bool
- func (job *Job) CancelRequested() bool
- func (job *Job) Cancelled() bool
- func (job *Job) Created() int64
- func (job *Job) DeepCopy() *Job
- func (job *Job) Equal(other *Job) bool
- func (job *Job) Failed() bool
- func (job *Job) GetAffinity() *v1.Affinity
- func (job *Job) GetAnnotations() map[string]string
- func (job *Job) GetId() string
- func (job *Job) GetJobSet() string
- func (job *Job) GetNodeSelector() map[string]string
- func (job *Job) GetPerQueuePriority() uint32
- func (job *Job) GetPodRequirements(_ map[string]types.PriorityClass) *schedulerobjects.PodRequirements
- func (job *Job) GetPriorityClassName() string
- func (job *Job) GetQueue() string
- func (job *Job) GetQueueTtlSeconds() int64
- func (job *Job) GetResourceRequirements() v1.ResourceRequirements
- func (job *Job) GetSchedulingKey() (schedulerobjects.SchedulingKey, bool)
- func (job *Job) GetSubmitTime() time.Time
- func (job *Job) GetTolerations() []v1.Toleration
- func (job *Job) HasQueueTtlExpired() bool
- func (job *Job) HasQueueTtlSet() bool
- func (job *Job) HasRuns() bool
- func (job *Job) Id() string
- func (job *Job) InTerminalState() bool
- func (job *Job) JobSchedulingInfo() *schedulerobjects.JobSchedulingInfo
- func (job *Job) Jobset() string
- func (job *Job) LatestRun() *JobRun
- func (job *Job) NumAttempts() uint
- func (job *Job) NumReturned() uint
- func (job *Job) PodRequirements() *schedulerobjects.PodRequirements
- func (job *Job) Priority() uint32
- func (job *Job) Queue() string
- func (job *Job) Queued() bool
- func (job *Job) QueuedVersion() int32
- func (job *Job) RequestedPriority() uint32
- func (job *Job) RunById(id uuid.UUID) *JobRun
- func (job *Job) SchedulingOrderCompare(other interfaces.LegacySchedulerJob) int
- func (job *Job) Succeeded() bool
- func (job *Job) WithCancelByJobsetRequested(cancelByJobsetRequested bool) *Job
- func (job *Job) WithCancelRequested(cancelRequested bool) *Job
- func (job *Job) WithCancelled(cancelled bool) *Job
- func (job *Job) WithCreated(created int64) *Job
- func (job *Job) WithFailed(failed bool) *Job
- func (job *Job) WithJobSchedulingInfo(jobSchedulingInfo *schedulerobjects.JobSchedulingInfo) *Job
- func (job *Job) WithJobset(jobset string) *Job
- func (job *Job) WithNewRun(executor string, nodeId, nodeName string) *Job
- func (job *Job) WithPriority(priority uint32) *Job
- func (job *Job) WithQueue(queue string) *Job
- func (job *Job) WithQueued(queued bool) *Job
- func (job *Job) WithQueuedVersion(version int32) *Job
- func (job *Job) WithRequestedPriority(priority uint32) *Job
- func (job *Job) WithSucceeded(succeeded bool) *Job
- func (job *Job) WithUpdatedRun(run *JobRun) *Job
- type JobDb
- type JobPriorityComparer
- type JobQueueTtlComparer
- type JobRun
- func (run *JobRun) Cancelled() bool
- func (run *JobRun) Created() int64
- func (run *JobRun) DeepCopy() *JobRun
- func (run *JobRun) Equal(other *JobRun) bool
- func (run *JobRun) Executor() string
- func (run *JobRun) Failed() bool
- func (run *JobRun) Id() uuid.UUID
- func (run *JobRun) InTerminalState() bool
- func (run *JobRun) JobId() string
- func (run *JobRun) NodeId() string
- func (run *JobRun) NodeName() string
- func (run *JobRun) Returned() bool
- func (run *JobRun) RunAttempted() bool
- func (run *JobRun) Running() bool
- func (run *JobRun) Succeeded() bool
- func (run *JobRun) WithAttempted(attempted bool) *JobRun
- func (run *JobRun) WithCancelled(cancelled bool) *JobRun
- func (run *JobRun) WithFailed(failed bool) *JobRun
- func (run *JobRun) WithReturned(returned bool) *JobRun
- func (run *JobRun) WithRunning(running bool) *JobRun
- func (run *JobRun) WithSucceeded(succeeded bool) *JobRun
- type Txn
- func (txn *Txn) Abort()
- func (txn *Txn) BatchDelete(ids []string) error
- func (txn *Txn) Commit()
- func (txn *Txn) GetAll() []*Job
- func (txn *Txn) GetById(id string) *Job
- func (txn *Txn) GetByRunId(runId uuid.UUID) *Job
- func (txn *Txn) HasQueuedJobs(queue string) bool
- func (txn *Txn) QueuedJobs(queue string) *immutable.SortedSetIterator[*Job]
- func (txn *Txn) QueuedJobsByTtl() *immutable.SortedSetIterator[*Job]
- func (txn *Txn) Upsert(jobs []*Job) error
- type UUIDHasher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SchedulingOrderCompare ¶ added in v0.4.0
SchedulingOrderCompare defines the order in which jobs in a queue should be scheduled (both when scheduling new jobs and when re-scheduling evicted jobs). Specifically, compare returns
- 0 if the jobs have equal job id,
- -1 if job should be scheduled before other,
- +1 if other should be scheduled before other.
Types ¶
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job is the scheduler-internal representation of a job.
func (*Job) CancelByJobsetRequested ¶
CancelByJobsetRequested returns true if the user has requested this job's jobSet be cancelled.
func (*Job) CancelRequested ¶
CancelRequested returns true if the user has requested this job be cancelled.
func (*Job) Equal ¶ added in v0.4.0
Equal returns true if job is equal to other and false otherwise. Scheduling requirements are assumed to be equal if both jobs have equal schedulingKey.
func (*Job) GetAffinity ¶ added in v0.3.71
Needed for compatibility with interfaces.LegacySchedulerJob
func (*Job) GetAnnotations ¶
GetAnnotations returns the annotations on the job. This is needed for compatibility with interfaces.LegacySchedulerJob
func (*Job) GetJobSet ¶
GetJobSet returns the jobSet the job belongs to. This is needed for compatibility with legacyJob
func (*Job) GetNodeSelector ¶ added in v0.3.71
Needed for compatibility with interfaces.LegacySchedulerJob
func (*Job) GetPerQueuePriority ¶ added in v0.3.77
GetPerQueuePriority exists for compatibility with the LegacyJob interface.
func (*Job) GetPodRequirements ¶ added in v0.3.78
func (job *Job) GetPodRequirements(_ map[string]types.PriorityClass) *schedulerobjects.PodRequirements
GetPodRequirements is needed for compatibility with interfaces.LegacySchedulerJob.
func (*Job) GetPriorityClassName ¶ added in v0.3.70
Needed for compatibility with interfaces.LegacySchedulerJob
func (*Job) GetQueue ¶
GetQueue returns the queue this job belongs to. This is needed for the LegacyJob interface.
func (*Job) GetQueueTtlSeconds ¶ added in v0.3.95
Needed for compatibility with interfaces.LegacySchedulerJob
func (*Job) GetResourceRequirements ¶ added in v0.3.71
func (job *Job) GetResourceRequirements() v1.ResourceRequirements
Needed for compatibility with interfaces.LegacySchedulerJob
func (*Job) GetSchedulingKey ¶ added in v0.3.100
func (job *Job) GetSchedulingKey() (schedulerobjects.SchedulingKey, bool)
GetSchedulingKey returns the scheduling key associated with a job. The second return value is always true since scheduling keys are computed at job creation time. This is needed for compatibility with interfaces.LegacySchedulerJob.
func (*Job) GetSubmitTime ¶ added in v0.3.77
GetSubmitTime exists for compatibility with the LegacyJob interface.
func (*Job) GetTolerations ¶ added in v0.3.71
func (job *Job) GetTolerations() []v1.Toleration
Needed for compatibility with interfaces.LegacySchedulerJob
func (*Job) HasQueueTtlExpired ¶ added in v0.3.95
HasQueueTtlExpired returns true if the given job has reached its queueTtl expiry. Invariants:
- job.created < `t`
func (*Job) HasQueueTtlSet ¶ added in v0.3.95
HasQueueTtlSet returns true if the given job has a queueTtl set.
func (*Job) HasRuns ¶
HasRuns returns true if the job has been run If this is returns true then LatestRun is guaranteed to return a non-nil value.
func (*Job) InTerminalState ¶
InTerminalState returns true if the job is in a terminal state
func (*Job) JobSchedulingInfo ¶
func (job *Job) JobSchedulingInfo() *schedulerobjects.JobSchedulingInfo
JobSchedulingInfo returns the scheduling requirements associated with the job
func (*Job) LatestRun ¶
LatestRun returns the currently active job run or nil if there are no runs yet. Callers should either guard against nil values explicitly or via HasRuns.
func (*Job) NumAttempts ¶ added in v0.3.63
NumAttempts returns the number of times the executors tried to run this job Note that this is O(N) on Runs, but this should be fine as the number of runs should be small.
func (*Job) NumReturned ¶
NumReturned returns the number of times this job has been returned by executors Note that this is O(N) on Runs, but this should be fine as the number of runs should be small.
func (*Job) PodRequirements ¶ added in v0.3.78
func (job *Job) PodRequirements() *schedulerobjects.PodRequirements
func (*Job) Queued ¶
Queued returns true if the job should be considered by the scheduler for assignment or false otherwise.
func (*Job) QueuedVersion ¶ added in v0.3.63
QueuedVersion returns current queued state version.
func (*Job) RequestedPriority ¶
RequestedPriority returns the requested priority of the job.
func (*Job) RunById ¶
RunById returns the Run corresponding to the provided run id or nil if no such Run exists.
func (*Job) SchedulingOrderCompare ¶ added in v0.4.0
func (job *Job) SchedulingOrderCompare(other interfaces.LegacySchedulerJob) int
SchedulingOrderCompare defines the order in which jobs in a particular queue should be scheduled,
func (*Job) WithCancelByJobsetRequested ¶
WithCancelByJobsetRequested returns a copy of the job with the cancelByJobSetRequested status updated.
func (*Job) WithCancelRequested ¶
WithCancelRequested returns a copy of the job with the cancelRequested status updated.
func (*Job) WithCancelled ¶
WithCancelled returns a copy of the job with the cancelled status updated
func (*Job) WithCreated ¶ added in v0.3.53
WithCreated returns a copy of the job with the creation time updated.
func (*Job) WithFailed ¶
WithFailed returns a copy of the job with the failed status updated.
func (*Job) WithJobSchedulingInfo ¶ added in v0.3.54
func (job *Job) WithJobSchedulingInfo(jobSchedulingInfo *schedulerobjects.JobSchedulingInfo) *Job
WithJobSchedulingInfo returns a copy of the job with the job scheduling info updated.
func (*Job) WithJobset ¶ added in v0.3.54
WithJobset returns a copy of the job with the jobSet updated.
func (*Job) WithNewRun ¶
WithNewRun creates a copy of the job with a new run on the given executor.
func (*Job) WithPriority ¶
WithPriority returns a copy of the job with the priority updated.
func (*Job) WithQueue ¶ added in v0.3.54
WithQueue returns a copy of the job with the queue updated.
func (*Job) WithQueued ¶
WithQueued returns a copy of the job with the queued status updated.
func (*Job) WithQueuedVersion ¶ added in v0.3.63
WithQueuedVersion returns a copy of the job with the queued version updated.
func (*Job) WithRequestedPriority ¶
WithRequestedPriority returns a copy of the job with the priority updated.
func (*Job) WithSucceeded ¶
WithSucceeded returns a copy of the job with the succeeded status updated.
func (*Job) WithUpdatedRun ¶
WithUpdatedRun creates a copy of the job with run details updated.
type JobDb ¶
type JobDb struct {
// contains filtered or unexported fields
}
func NewJobDb ¶
func NewJobDb(priorityClasses map[string]types.PriorityClass, defaultPriorityClassName string) *JobDb
func NewJobDbWithSchedulingKeyGenerator ¶ added in v0.3.100
func NewJobDbWithSchedulingKeyGenerator( priorityClasses map[string]types.PriorityClass, defaultPriorityClassName string, skg *schedulerobjects.SchedulingKeyGenerator, ) *JobDb
func (*JobDb) NewJob ¶ added in v0.3.100
func (jobDb *JobDb) NewJob( jobId string, jobSet string, queue string, priority uint32, schedulingInfo *schedulerobjects.JobSchedulingInfo, queued bool, queuedVersion int32, cancelRequested bool, cancelByJobSetRequested bool, cancelled bool, created int64, ) *Job
NewJob creates a new scheduler job. The new job is not automatically inserted into the jobDb; call jobDb.Upsert to upsert it.
type JobPriorityComparer ¶ added in v0.3.53
type JobPriorityComparer struct{}
func (JobPriorityComparer) Compare ¶ added in v0.3.53
func (JobPriorityComparer) Compare(job, other *Job) int
type JobQueueTtlComparer ¶ added in v0.3.95
type JobQueueTtlComparer struct{}
func (JobQueueTtlComparer) Compare ¶ added in v0.3.95
func (j JobQueueTtlComparer) Compare(a, b *Job) int
Compare jobs by their remaining queue time before expiry Invariants:
- Job.queueTtl must be > 0
- Job.created must be < `t`
type JobRun ¶
type JobRun struct {
// contains filtered or unexported fields
}
JobRun is the scheduler-internal representation of a job run.
func CreateRun ¶
func CreateRun( id uuid.UUID, jobId string, creationTime int64, executor string, nodeId string, nodeName string, running bool, succeeded bool, failed bool, cancelled bool, returned bool, runAttempted bool, ) *JobRun
CreateRun creates a new scheduler job run from a database job run
func (*JobRun) InTerminalState ¶
InTerminalState returns true if the JobRun is in a terminal state
func (*JobRun) NodeId ¶ added in v0.3.82
NodeId returns the id of the node to which the JobRun is assigned.
func (*JobRun) NodeName ¶ added in v0.3.82
NodeId returns the name of the node to which the JobRun is assigned.
func (*JobRun) RunAttempted ¶ added in v0.3.63
RunAttempted Returns true if the executor has attempted to run the job.
func (*JobRun) Succeeded ¶
Succeeded Returns true if the executor has reported the job run as successful
func (*JobRun) WithAttempted ¶ added in v0.3.63
WithAttempted returns a copy of the job run with the runAttempted status updated.
func (*JobRun) WithCancelled ¶
WithCancelled returns a copy of the job run with the cancelled status updated.
func (*JobRun) WithFailed ¶
WithFailed returns a copy of the job run with the failed status updated.
func (*JobRun) WithReturned ¶
func (*JobRun) WithRunning ¶
WithRunning returns a copy of the job run with the running status updated.
func (*JobRun) WithSucceeded ¶
WithSucceeded returns a copy of the job run with the succeeded status updated.
type Txn ¶ added in v0.3.53
type Txn struct {
// contains filtered or unexported fields
}
Txn is a JobDb Transaction. Transactions provide a consistent view of the database, allowing readers to perform multiple actions without the database changing from underneath them. Write transactions also allow callers to perform write operations that will not be visible to other users until the transaction is committed.
func (*Txn) BatchDelete ¶ added in v0.4.1
BatchDelete deletes the jobs with the given ids from the database. Any ids not in the database are ignored.
func (*Txn) GetAll ¶ added in v0.4.1
GetAll returns all jobs in the database. The Jobs returned by this function *must not* be subsequently modified
func (*Txn) GetById ¶ added in v0.4.1
GetById returns the job with the given Id or nil if no such job exists The Job returned by this function *must not* be subsequently modified
func (*Txn) GetByRunId ¶ added in v0.4.1
GetByRunId returns the job with the given run id or nil if no such job exists The Job returned by this function *must not* be subsequently modified
func (*Txn) HasQueuedJobs ¶ added in v0.4.1
HasQueuedJobs returns true if the queue has any jobs in the running state or false otherwise
func (*Txn) QueuedJobs ¶ added in v0.4.1
func (txn *Txn) QueuedJobs(queue string) *immutable.SortedSetIterator[*Job]
QueuedJobs returns true if the queue has any jobs in the running state or false otherwise
func (*Txn) QueuedJobsByTtl ¶ added in v0.4.1
func (txn *Txn) QueuedJobsByTtl() *immutable.SortedSetIterator[*Job]
QueuedJobsByTtl returns an iterator for jobs ordered by queue ttl time - the closest to expiry first
type UUIDHasher ¶ added in v0.3.89
type UUIDHasher struct{}
UUIDHasher is an implementation of Hasher for UUID.