Documentation ¶
Index ¶
- func Migrate(ctx context.Context, db pgxtype.Querier) error
- func WithTestDb(action func(queries *Queries, db *pgxpool.Pool) error) error
- type DBTX
- type Executor
- type ExecutorRepository
- type Job
- type JobRepository
- type JobRunError
- type JobRunLease
- type Marker
- type PostgresExecutorRepository
- func (r *PostgresExecutorRepository) GetExecutors(ctx context.Context) ([]*schedulerobjects.Executor, error)
- func (r *PostgresExecutorRepository) GetLastUpdateTimes(ctx context.Context) (map[string]time.Time, error)
- func (r *PostgresExecutorRepository) StoreExecutor(ctx context.Context, executor *schedulerobjects.Executor) error
- type PostgresJobRepository
- func (r *PostgresJobRepository) CountReceivedPartitions(ctx context.Context, groupId uuid.UUID) (uint32, error)
- func (r *PostgresJobRepository) FetchJobRunErrors(ctx context.Context, runIds []uuid.UUID) (map[uuid.UUID]*armadaevents.JobRunErrors, error)
- func (r *PostgresJobRepository) FetchJobRunLeases(ctx context.Context, executor string, maxResults int, ...) ([]*JobRunLease, error)
- func (r *PostgresJobRepository) FetchJobUpdates(ctx context.Context, jobSerial int64, jobRunSerial int64) ([]Job, []Run, error)
- func (r *PostgresJobRepository) FindInactiveRuns(ctx context.Context, runIds []uuid.UUID) ([]uuid.UUID, error)
- type Queries
- func (q *Queries) CountGroup(ctx context.Context, groupID uuid.UUID) (int64, error)
- func (q *Queries) FindActiveRuns(ctx context.Context, runIds []uuid.UUID) ([]uuid.UUID, error)
- func (q *Queries) MarkJobRunsCancelledByJobId(ctx context.Context, jobIds []string) error
- func (q *Queries) MarkJobRunsCancelledBySets(ctx context.Context, jobSets []string) error
- func (q *Queries) MarkJobRunsFailedById(ctx context.Context, runIds []uuid.UUID) error
- func (q *Queries) MarkJobRunsRunningById(ctx context.Context, runIds []uuid.UUID) error
- func (q *Queries) MarkJobRunsSucceededById(ctx context.Context, runIds []uuid.UUID) error
- func (q *Queries) MarkJobsCancelledById(ctx context.Context, jobIds []string) error
- func (q *Queries) MarkJobsCancelledBySets(ctx context.Context, jobSets []string) error
- func (q *Queries) MarkJobsFailedById(ctx context.Context, jobIds []string) error
- func (q *Queries) MarkJobsSucceededById(ctx context.Context, jobIds []string) error
- func (q *Queries) SelectAllExecutors(ctx context.Context) ([]Executor, error)
- func (q *Queries) SelectExecutorUpdateTimes(ctx context.Context) ([]SelectExecutorUpdateTimesRow, error)
- func (q *Queries) SelectJobsForExecutor(ctx context.Context, arg SelectJobsForExecutorParams) ([]SelectJobsForExecutorRow, error)
- func (q *Queries) SelectNewJobs(ctx context.Context, arg SelectNewJobsParams) ([]Job, error)
- func (q *Queries) SelectNewRuns(ctx context.Context, arg SelectNewRunsParams) ([]Run, error)
- func (q *Queries) SelectNewRunsForJobs(ctx context.Context, arg SelectNewRunsForJobsParams) ([]Run, error)
- func (q *Queries) SelectRunErrorsById(ctx context.Context, runIds []uuid.UUID) ([]JobRunError, error)
- func (q *Queries) SelectUpdatedJobs(ctx context.Context, arg SelectUpdatedJobsParams) ([]SelectUpdatedJobsRow, error)
- func (q *Queries) UpdateJobPriorityById(ctx context.Context, arg UpdateJobPriorityByIdParams) error
- func (q *Queries) UpdateJobPriorityByJobSet(ctx context.Context, arg UpdateJobPriorityByJobSetParams) error
- func (q *Queries) UpsertExecutor(ctx context.Context, arg UpsertExecutorParams) error
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type Queue
- type QueueRepository
- type Run
- type SelectExecutorUpdateTimesRow
- type SelectJobsForExecutorParams
- type SelectJobsForExecutorRow
- type SelectNewJobsParams
- type SelectNewRunsForJobsParams
- type SelectNewRunsParams
- type SelectUpdatedJobsParams
- type SelectUpdatedJobsRow
- type UpdateJobPriorityByIdParams
- type UpdateJobPriorityByJobSetParams
- type UpsertExecutorParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExecutorRepository ¶
type ExecutorRepository interface { // GetExecutors returns all known executors, regardless of their last heartbeat time GetExecutors(ctx context.Context) ([]*schedulerobjects.Executor, error) // GetLastUpdateTimes returns a map of executor name -> last heartbeat time GetLastUpdateTimes(ctx context.Context) (map[string]time.Time, error) // StoreExecutor persists the latest executor state StoreExecutor(ctx context.Context, executor *schedulerobjects.Executor) error }
ExecutorRepository is an interface to be implemented by structs which provide executor information
type Job ¶
type Job struct { JobID string `db:"job_id"` JobSet string `db:"job_set"` Queue string `db:"queue"` UserID string `db:"user_id"` Submitted int64 `db:"submitted"` Groups []byte `db:"groups"` Priority int64 `db:"priority"` CancelRequested bool `db:"cancel_requested"` Cancelled bool `db:"cancelled"` Succeeded bool `db:"succeeded"` Failed bool `db:"failed"` SubmitMessage []byte `db:"submit_message"` SchedulingInfo []byte `db:"scheduling_info"` Serial int64 `db:"serial"` LastModified time.Time `db:"last_modified"` }
func (Job) InTerminalState ¶
InTerminalState returns true if Job is in a terminal state
type JobRepository ¶
type JobRepository interface { // FetchJobUpdates returns all jobs and job dbRuns that have been updated after jobSerial and jobRunSerial respectively // These updates are guaranteed to be consistent with each other FetchJobUpdates(ctx context.Context, jobSerial int64, jobRunSerial int64) ([]Job, []Run, error) // FetchJobRunErrors returns all armadaevents.JobRunErrors for the provided job run ids. The returned map is // keyed by job run id. Any dbRuns which don't have errors wil be absent from the map. FetchJobRunErrors(ctx context.Context, runIds []uuid.UUID) (map[uuid.UUID]*armadaevents.JobRunErrors, error) // CountReceivedPartitions returns a count of the number of partition messages present in the database corresponding // to the provided groupId. This is used by the scheduler to determine if the database represents the state of // pulsar after a given point in time. CountReceivedPartitions(ctx context.Context, groupId uuid.UUID) (uint32, error) // FindInactiveRuns returns a slice containing all dbRuns that the scheduler does not currently consider active // Runs are inactive if they don't exist or if they have succeeded, failed or been cancelled FindInactiveRuns(ctx context.Context, runIds []uuid.UUID) ([]uuid.UUID, error) // FetchJobRunLeases fetches new job runs for a given executor. A maximum of maxResults rows will be returned, while run // in excludedRunIds will be excluded FetchJobRunLeases(ctx context.Context, executor string, maxResults int, excludedRunIds []uuid.UUID) ([]*JobRunLease, error) }
JobRepository is an interface to be implemented by structs which provide job and run information
type JobRunError ¶
type JobRunLease ¶
type PostgresExecutorRepository ¶
type PostgresExecutorRepository struct {
// contains filtered or unexported fields
}
PostgresExecutorRepository is an implementation of ExecutorRepository that stores its state in postgres
func NewPostgresExecutorRepository ¶
func NewPostgresExecutorRepository(db *pgxpool.Pool, compressor compress.Compressor, decompressor compress.Decompressor) *PostgresExecutorRepository
func (*PostgresExecutorRepository) GetExecutors ¶
func (r *PostgresExecutorRepository) GetExecutors(ctx context.Context) ([]*schedulerobjects.Executor, error)
GetExecutors returns all known executors, regardless of their last heartbeat time
func (*PostgresExecutorRepository) GetLastUpdateTimes ¶
func (r *PostgresExecutorRepository) GetLastUpdateTimes(ctx context.Context) (map[string]time.Time, error)
GetLastUpdateTimes returns a map of executor name -> last heartbeat time
func (*PostgresExecutorRepository) StoreExecutor ¶
func (r *PostgresExecutorRepository) StoreExecutor(ctx context.Context, executor *schedulerobjects.Executor) error
StoreExecutor persists the latest executor state
type PostgresJobRepository ¶
type PostgresJobRepository struct {
// contains filtered or unexported fields
}
PostgresJobRepository is an implementation of JobRepository that stores its state in postgres
func NewPostgresJobRepository ¶
func NewPostgresJobRepository(db *pgxpool.Pool, batchSize int32) *PostgresJobRepository
func (*PostgresJobRepository) CountReceivedPartitions ¶
func (r *PostgresJobRepository) CountReceivedPartitions(ctx context.Context, groupId uuid.UUID) (uint32, error)
CountReceivedPartitions returns a count of the number of partition messages present in the database corresponding to the provided groupId. This is used by the scheduler to determine if the database represents the state of pulsar after a given point in time.
func (*PostgresJobRepository) FetchJobRunErrors ¶
func (r *PostgresJobRepository) FetchJobRunErrors(ctx context.Context, runIds []uuid.UUID) (map[uuid.UUID]*armadaevents.JobRunErrors, error)
FetchJobRunErrors returns all armadaevents.JobRunErrors for the provided job run ids. The returned map is keyed by job run id. Any dbRuns which don't have errors wil be absent from the map.
func (*PostgresJobRepository) FetchJobRunLeases ¶
func (r *PostgresJobRepository) FetchJobRunLeases(ctx context.Context, executor string, maxResults int, excludedRunIds []uuid.UUID) ([]*JobRunLease, error)
FetchJobRunLeases fetches new job runs for a given executor. A maximum of maxResults rows will be returned, while run in excludedRunIds will be excluded
func (*PostgresJobRepository) FetchJobUpdates ¶
func (r *PostgresJobRepository) FetchJobUpdates(ctx context.Context, jobSerial int64, jobRunSerial int64) ([]Job, []Run, error)
FetchJobUpdates returns all jobs and job dbRuns that have been updated after jobSerial and jobRunSerial respectively These updates are guaranteed to be consistent with each other
func (*PostgresJobRepository) FindInactiveRuns ¶
func (r *PostgresJobRepository) FindInactiveRuns(ctx context.Context, runIds []uuid.UUID) ([]uuid.UUID, error)
FindInactiveRuns returns a slice containing all dbRuns that the scheduler does not currently consider active Runs are inactive if they don't exist or if they have succeeded, failed or been cancelled
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) CountGroup ¶
func (*Queries) FindActiveRuns ¶
func (*Queries) MarkJobRunsCancelledByJobId ¶
func (*Queries) MarkJobRunsCancelledBySets ¶
func (*Queries) MarkJobRunsFailedById ¶
func (*Queries) MarkJobRunsRunningById ¶
func (*Queries) MarkJobRunsSucceededById ¶
func (*Queries) MarkJobsCancelledById ¶
func (*Queries) MarkJobsCancelledBySets ¶
func (*Queries) MarkJobsFailedById ¶
func (*Queries) MarkJobsSucceededById ¶
func (*Queries) SelectAllExecutors ¶
func (*Queries) SelectExecutorUpdateTimes ¶
func (q *Queries) SelectExecutorUpdateTimes(ctx context.Context) ([]SelectExecutorUpdateTimesRow, error)
func (*Queries) SelectJobsForExecutor ¶
func (q *Queries) SelectJobsForExecutor(ctx context.Context, arg SelectJobsForExecutorParams) ([]SelectJobsForExecutorRow, error)
func (*Queries) SelectNewJobs ¶
func (*Queries) SelectNewRuns ¶
func (*Queries) SelectNewRunsForJobs ¶
func (*Queries) SelectRunErrorsById ¶
func (q *Queries) SelectRunErrorsById(ctx context.Context, runIds []uuid.UUID) ([]JobRunError, error)
Run errors
func (*Queries) SelectUpdatedJobs ¶
func (q *Queries) SelectUpdatedJobs(ctx context.Context, arg SelectUpdatedJobsParams) ([]SelectUpdatedJobsRow, error)
func (*Queries) UpdateJobPriorityById ¶
func (q *Queries) UpdateJobPriorityById(ctx context.Context, arg UpdateJobPriorityByIdParams) error
func (*Queries) UpdateJobPriorityByJobSet ¶
func (q *Queries) UpdateJobPriorityByJobSet(ctx context.Context, arg UpdateJobPriorityByJobSetParams) error
func (*Queries) UpsertExecutor ¶
func (q *Queries) UpsertExecutor(ctx context.Context, arg UpsertExecutorParams) error
type QueueRepository ¶
type Run ¶
type Run struct { RunID uuid.UUID `db:"run_id"` JobID string `db:"job_id"` JobSet string `db:"job_set"` Executor string `db:"executor"` Cancelled bool `db:"cancelled"` Running bool `db:"running"` Succeeded bool `db:"succeeded"` Failed bool `db:"failed"` Returned bool `db:"returned"` Serial int64 `db:"serial"` LastModified time.Time `db:"last_modified"` }
type SelectNewJobsParams ¶
type SelectNewRunsParams ¶
type SelectUpdatedJobsParams ¶
type SelectUpdatedJobsRow ¶
type SelectUpdatedJobsRow struct { JobID string `db:"job_id"` JobSet string `db:"job_set"` Queue string `db:"queue"` Priority int64 `db:"priority"` Submitted int64 `db:"submitted"` CancelRequested bool `db:"cancel_requested"` Cancelled bool `db:"cancelled"` Succeeded bool `db:"succeeded"` Failed bool `db:"failed"` SchedulingInfo []byte `db:"scheduling_info"` Serial int64 `db:"serial"` }
func (SelectUpdatedJobsRow) GetSerial ¶
func (row SelectUpdatedJobsRow) GetSerial() int64
GetSerial is needed for the HasSerial interface