repository

package
v0.3.79-rc-e061b91 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	JobQueued           JobState = "QUEUED"
	JobPending          JobState = "PENDING"
	JobRunning          JobState = "RUNNING"
	JobSucceeded        JobState = "SUCCEEDED"
	JobFailed           JobState = "FAILED"
	JobCancelled        JobState = "CANCELLED"
	JobDuplicate        JobState = "DUPLICATE"
	JobQueuedOrdinal             = 1
	JobPendingOrdinal            = 2
	JobRunningOrdinal            = 3
	JobSucceededOrdinal          = 4
	JobFailedOrdinal             = 5
	JobCancelledOrdinal          = 6
	JobDuplicateOrdinal          = 7
)
View Source
const (
	SearchWildcard  string = "*"
	SQLLikeWildcard string = "%"
)

Variables

Functions

func DeleteOldJobs

func DeleteOldJobs(db *sql.DB, batchSizeLimit int, cutoff time.Time) error

DeleteOldJobs deletes jobs from the database that were submitted before cutoff. The jobs are deleted in batches with the maximum number of jobs being deleted in each batch being given by batchSizeLimit. The tables from which the jobs wil be deleted are: * user_annotation_lookup * job_run_container * job_run * job This function returns nil if the operation succeeded and an error otherwise. Note that For performance reasons we don't use a transaction here and so an error may indicate that Some jobs were deleted.

func GlobSearchOrExact

func GlobSearchOrExact(field exp.IdentifierExpression, pattern string) goqu.Expression

Do a glob (sql like) search if the pattern contains any * characters, otherwise do an exact match.

func NewNullString

func NewNullString(s string) sql.NullString

func ParseNullBool

func ParseNullBool(nullBool sql.NullBool) bool

func ParseNullFloat

func ParseNullFloat(nullFloat sql.NullFloat64) float64

func ParseNullInt

func ParseNullInt(nullInt sql.NullInt64) int64

func ParseNullTimeDefault

func ParseNullTimeDefault(nullTime sql.NullTime) time.Time

func StartsWith

func StartsWith(field exp.IdentifierExpression, pattern string) goqu.Expression

func ToUTC

func ToUTC(t time.Time) time.Time

Types

type JobRecorder

type JobRecorder interface {
	RecordJob(job *api.Job, timestamp time.Time) error
	MarkCancelled(*api.JobCancelledEvent) error

	RecordJobPending(event *api.JobPendingEvent) error
	RecordJobRunning(event *api.JobRunningEvent) error
	RecordJobSucceeded(event *api.JobSucceededEvent) error
	RecordJobFailed(event *api.JobFailedEvent) error
	RecordJobUnableToSchedule(event *api.JobUnableToScheduleEvent) error
	RecordJobDuplicate(event *api.JobDuplicateFoundEvent) error
	RecordJobTerminated(event *api.JobTerminatedEvent) error
	RecordJobReprioritized(event *api.JobReprioritizedEvent) error
}

type JobRepository

type JobRepository interface {
	GetQueueInfos(ctx context.Context) ([]*lookout.QueueInfo, error)
	GetJobSetInfos(ctx context.Context, opts *lookout.GetJobSetsRequest) ([]*lookout.JobSetInfo, error)
	GetJobs(ctx context.Context, opts *lookout.GetJobsRequest) ([]*lookout.JobInfo, error)
}

type JobRow

type JobRow struct {
	JobId       sql.NullString  `db:"job_id"`
	Queue       sql.NullString  `db:"queue"`
	Owner       sql.NullString  `db:"owner"`
	JobSet      sql.NullString  `db:"jobset"`
	Priority    sql.NullFloat64 `db:"priority"`
	Submitted   sql.NullTime    `db:"submitted"`
	Cancelled   sql.NullTime    `db:"cancelled"`
	Preempted   sql.NullTime    `db:"preempted"`
	OrigJobSpec []byte          `db:"orig_job_spec"`
	State       sql.NullInt64   `db:"state"`
	RunId       sql.NullString  `db:"run_id"`
	PodNumber   sql.NullInt64   `db:"pod_number"`
	Cluster     sql.NullString  `db:"cluster"`
	Node        sql.NullString  `db:"node"`
	Created     sql.NullTime    `db:"created"`
	Started     sql.NullTime    `db:"started"`
	Finished    sql.NullTime    `db:"finished"`
	Succeeded   sql.NullBool    `db:"succeeded"`
	Error       sql.NullString  `db:"error"`
}

type JobState

type JobState string

Emulates JobStates enum can't use protobuf enums because gogoproto + grpc-gateway is hard with K8s specific messages

type SQLJobRepository

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

func NewSQLJobRepository

func NewSQLJobRepository(db *goqu.Database, clock util.Clock) *SQLJobRepository

func (*SQLJobRepository) GetJobSetInfos

func (r *SQLJobRepository) GetJobSetInfos(ctx context.Context, opts *lookout.GetJobSetsRequest) ([]*lookout.JobSetInfo, error)

func (*SQLJobRepository) GetJobs

func (*SQLJobRepository) GetQueueInfos

func (r *SQLJobRepository) GetQueueInfos(ctx context.Context) ([]*lookout.QueueInfo, error)

type SQLJobStore

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

func NewSQLJobStore

func NewSQLJobStore(db *goqu.Database, annotationPrefix string) *SQLJobStore

func (*SQLJobStore) MarkCancelled

func (r *SQLJobStore) MarkCancelled(event *api.JobCancelledEvent) error

func (*SQLJobStore) RecordJob

func (r *SQLJobStore) RecordJob(job *api.Job, timestamp time.Time) error

func (*SQLJobStore) RecordJobDuplicate

func (r *SQLJobStore) RecordJobDuplicate(event *api.JobDuplicateFoundEvent) error

func (*SQLJobStore) RecordJobFailed

func (r *SQLJobStore) RecordJobFailed(event *api.JobFailedEvent) error

func (*SQLJobStore) RecordJobPending

func (r *SQLJobStore) RecordJobPending(event *api.JobPendingEvent) error

func (*SQLJobStore) RecordJobReprioritized

func (r *SQLJobStore) RecordJobReprioritized(event *api.JobReprioritizedEvent) error

func (*SQLJobStore) RecordJobRunning

func (r *SQLJobStore) RecordJobRunning(event *api.JobRunningEvent) error

func (*SQLJobStore) RecordJobSucceeded

func (r *SQLJobStore) RecordJobSucceeded(event *api.JobSucceededEvent) error

func (*SQLJobStore) RecordJobTerminated

func (r *SQLJobStore) RecordJobTerminated(event *api.JobTerminatedEvent) error

func (*SQLJobStore) RecordJobUnableToSchedule

func (r *SQLJobStore) RecordJobUnableToSchedule(event *api.JobUnableToScheduleEvent) error

type SqlHealth

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

func NewSqlHealth

func NewSqlHealth(db *sql.DB) *SqlHealth

func (*SqlHealth) Check

func (r *SqlHealth) Check() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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