repository

package
v0.3.42 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: Apache-2.0 Imports: 18 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 added in v0.2.11

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 added in v0.3.37

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 added in v0.1.39

func NewNullString(s string) sql.NullString

func ParseNullBool added in v0.1.17

func ParseNullBool(nullBool sql.NullBool) bool

func ParseNullFloat added in v0.1.17

func ParseNullFloat(nullFloat sql.NullFloat64) float64

func ParseNullInt added in v0.1.21

func ParseNullInt(nullInt sql.NullInt64) int64

func ParseNullString added in v0.1.17

func ParseNullString(nullString sql.NullString) string

func ParseNullTime added in v0.1.17

func ParseNullTime(nullTime sql.NullTime) *time.Time

func ParseNullTimeDefault added in v0.1.17

func ParseNullTimeDefault(nullTime sql.NullTime) time.Time

func StartsWith added in v0.1.29

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

func ToUTC added in v0.1.31

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 added in v0.1.21

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 added in v0.1.23

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 added in v0.1.21

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

func (*SQLJobRepository) GetJobs added in v0.1.23

func (*SQLJobRepository) GetQueueInfos added in v0.1.21

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 added in v0.1.33

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 added in v0.1.39

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 added in v0.1.34

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

func (*SQLJobStore) RecordJobUnableToSchedule added in v0.1.23

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

type SqlHealth added in v0.2.3

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

func NewSqlHealth added in v0.2.3

func NewSqlHealth(db *sql.DB) *SqlHealth

func (*SqlHealth) Check added in v0.2.3

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