repository

package
v0.1.31 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IntToJobStateMap = map[int]JobState{
	1: JobQueued,
	2: JobPending,
	3: JobRunning,
	4: JobSucceeded,
	5: JobFailed,
	6: JobCancelled,
}
View Source
var JobStateToIntMap = map[JobState]int{
	JobQueued:    1,
	JobPending:   2,
	JobRunning:   3,
	JobSucceeded: 4,
	JobFailed:    5,
	JobCancelled: 6,
}

Functions

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 pq.NullTime) *time.Time

func ParseNullTimeDefault added in v0.1.17

func ParseNullTimeDefault(nullTime pq.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 Clock added in v0.1.21

type Clock interface {
	Now() time.Time
}

type DefaultClock added in v0.1.21

type DefaultClock struct{}

func (*DefaultClock) Now added in v0.1.21

func (c *DefaultClock) Now() time.Time

type JobRecorder

type JobRecorder interface {
	RecordJob(job *api.Job) error
	MarkCancelled(*api.JobCancelledEvent) error
	RecordJobPriorityChange(event *api.JobReprioritizedEvent) 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
}

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 pq.NullTime     `db:"submitted"`
	Cancelled pq.NullTime     `db:"cancelled"`
	JobJson   sql.NullString  `db:"job"`
	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   pq.NullTime     `db:"created"`
	Started   pq.NullTime     `db:"started"`
	Finished  pq.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

const (
	JobQueued    JobState = "QUEUED"
	JobPending   JobState = "PENDING"
	JobRunning   JobState = "RUNNING"
	JobSucceeded JobState = "SUCCEEDED"
	JobFailed    JobState = "FAILED"
	JobCancelled JobState = "CANCELLED"
)

type SQLJobRepository

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

func NewSQLJobRepository

func NewSQLJobRepository(db *goqu.Database, clock 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) *SQLJobStore

func (*SQLJobStore) MarkCancelled

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

func (*SQLJobStore) RecordJob

func (r *SQLJobStore) RecordJob(job *api.Job) 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) RecordJobPriorityChange

func (r *SQLJobStore) RecordJobPriorityChange(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) RecordJobUnableToSchedule added in v0.1.23

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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