Documentation ¶
Index ¶
- type Job
- func (job *Job) CancelByJobsetRequested() bool
- func (job *Job) CancelRequested() bool
- func (job *Job) Cancelled() bool
- func (job *Job) Created() int64
- func (job *Job) Failed() bool
- func (job *Job) GetAnnotations() map[string]string
- func (job *Job) GetId() string
- func (job *Job) GetJobSet() string
- func (job *Job) GetQueue() string
- func (job *Job) GetRequirements(_ map[string]configuration.PriorityClass) *schedulerobjects.JobSchedulingInfo
- 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) NumReturned() uint
- func (job *Job) Priority() uint32
- func (job *Job) Queue() string
- func (job *Job) Queued() bool
- func (job *Job) RequestedPriority() uint32
- func (job *Job) RunById(id uuid.UUID) *JobRun
- 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) WithFailed(failed bool) *Job
- func (job *Job) WithNewRun(executor string, node string) *Job
- func (job *Job) WithPriority(priority uint32) *Job
- func (job *Job) WithQueued(queued bool) *Job
- func (job *Job) WithRequestedPriority(priority uint32) *Job
- func (job *Job) WithSucceeded(succeeded bool) *Job
- func (job *Job) WithUpdatedRun(run *JobRun) *Job
- type JobDb
- func (jobDb *JobDb) BatchDelete(txn *memdb.Txn, ids []string) error
- func (jobDb *JobDb) GetAll(txn *memdb.Txn) ([]*Job, error)
- func (jobDb *JobDb) GetById(txn *memdb.Txn, id string) (*Job, error)
- func (jobDb *JobDb) GetByRunId(txn *memdb.Txn, runId uuid.UUID) (*Job, error)
- func (jobDb *JobDb) HasQueuedJobs(txn *memdb.Txn, queue string) (bool, error)
- func (jobDb *JobDb) ReadTxn() *memdb.Txn
- func (jobDb *JobDb) Upsert(txn *memdb.Txn, jobs []*Job) error
- func (jobDb *JobDb) WriteTxn() *memdb.Txn
- type JobQueueIterator
- type JobRun
- func (run *JobRun) Cancelled() bool
- func (run *JobRun) Created() int64
- func (run *JobRun) Executor() string
- func (run *JobRun) Failed() bool
- func (run *JobRun) Id() uuid.UUID
- func (run *JobRun) InTerminalState() bool
- func (run *JobRun) Node() string
- func (run *JobRun) Returned() bool
- func (run *JobRun) Running() bool
- func (run *JobRun) Succeeded() bool
- 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 LeasedJobsIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job is the scheduler-internal representation of a job.
func NewJob ¶
func NewJob( jobId string, jobset string, queue string, priority uint32, schedulingInfo *schedulerobjects.JobSchedulingInfo, cancelRequested bool, cancelByJobsetRequested bool, cancelled bool, created int64, ) *Job
NewJob creates a new scheduler 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) GetAnnotations ¶
GetAnnotations returns the annotations on the job. This is needed for compatibility with LegacySchedulerJob
func (*Job) GetJobSet ¶
GetJobSet returns the jobset the job belongs to. This is needed for compatibility with legacyJob
func (*Job) GetQueue ¶
GetQueue returns the queue this job belongs to. This is needed for the LegacyJob interface.
func (*Job) GetRequirements ¶
func (job *Job) GetRequirements(_ map[string]configuration.PriorityClass) *schedulerobjects.JobSchedulingInfo
GetRequirements returns the scheduling requirements associated with the job. this is needed for compatibility with LegacySchedulerJob
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) 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) Queued ¶
Queued returns true if the job should be considered by the scheduler for assignment or false otherwise.
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) 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) WithFailed ¶
WithFailed returns a copy of the job with the failed status 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) WithQueued ¶
WithQueued returns a copy of the job with the queued status updated.
func (*Job) WithRequestedPriority ¶
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 { // In-memory database. Stores *Job. // Used to efficiently iterate over jobs in sorted order. Db *memdb.MemDB }
JobDb is the scheduler-internal system for storing job queues. It allows for efficiently iterating over jobs in a specified queue sorted first by in-queue priority value (smaller to greater, since smaller values indicate higher priority), and second by submission time. JobDb is implemented on top of https://github.com/hashicorp/go-memdb which is a simple in-memory database built on immutable radix trees.
func (*JobDb) BatchDelete ¶
BatchDelete removes the jobs with the given ids from the database. Any ids that are not in the database will be ignored
func (*JobDb) GetAll ¶
GetAll returns all jobs in the database. The Jobs returned by this function *must not* be subsequently modified
func (*JobDb) GetById ¶
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 (*JobDb) GetByRunId ¶
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 (*JobDb) HasQueuedJobs ¶
HasQueuedJobs returns true if the queue has any jobs in the running state or false otherwise
func (*JobDb) ReadTxn ¶
func (jobDb *JobDb) ReadTxn() *memdb.Txn
ReadTxn returns a read-only transaction. Multiple read-only transactions can access the db concurrently
type JobQueueIterator ¶
type JobQueueIterator struct {
// contains filtered or unexported fields
}
JobQueueIterator is an iterator over all jobs in a given queue. Jobs are sorted first by per-queue priority, and secondly by submission time.
func NewJobQueueIterator ¶
func NewJobQueueIterator(txn *memdb.Txn, queue string) (*JobQueueIterator, error)
func (*JobQueueIterator) Next ¶
func (it *JobQueueIterator) Next() interface{}
Next is needed to implement the memdb.ResultIterator interface. External callers should use NextJobItem which provides a typesafe mechanism for getting the next Job
func (*JobQueueIterator) NextJobItem ¶
func (it *JobQueueIterator) NextJobItem() *Job
NextJobItem returns the next Job or nil if the end of the iterator has been reached
func (*JobQueueIterator) WatchCh ¶
func (it *JobQueueIterator) WatchCh() <-chan struct{}
WatchCh is needed to implement the memdb.ResultIterator interface but is not needed for our use case
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, creationTime int64, executor string, node string, running bool, succeeded bool, failed bool, cancelled bool, returned 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) Succeeded ¶
Succeeded Returns true if the executor has reported the job run as successful
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 ¶
WithReturned returns a copy of the job run with the returned status updated.
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 LeasedJobsIterator ¶
type LeasedJobsIterator struct {
// contains filtered or unexported fields
}
LeasedJobsIterator is an iterator over all queued jobs
func NewLeasedJobsIterator ¶
func NewLeasedJobsIterator(txn *memdb.Txn) (*LeasedJobsIterator, error)
func (*LeasedJobsIterator) Next ¶
func (it *LeasedJobsIterator) Next() interface{}
Next is needed to implement the memdb.ResultIterator interface. External callers should use NextJobItem which provides a typesafe mechanism for getting the next Job
func (*LeasedJobsIterator) NextJobItem ¶
func (it *LeasedJobsIterator) NextJobItem() *Job
NextJobItem returns the next Job or nil if the end of the iterator has been reached
func (*LeasedJobsIterator) WatchCh ¶
func (it *LeasedJobsIterator) WatchCh() <-chan struct{}
WatchCh is needed to implement the memdb.ResultIterator interface but is not needed for our use case