repository

package
v0.4.47 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown     AggregateType = -1
	Max                       = 0
	Average                   = 1
	StateCounts               = 2
	Min                       = 3
)

Variables

This section is empty.

Functions

func GetStatesForFilter added in v0.3.77

func GetStatesForFilter(filters []*model.Filter) []string

GetStatesForFilter returns a list of states as string if filter for state exists Will always return the states in the same order, irrespective of the ordering of the states in the filter

Types

type AggregateType added in v0.3.50

type AggregateType int

type BasicParser added in v0.3.77

type BasicParser[T any] struct {
	// contains filtered or unexported fields
}

func (*BasicParser[T]) GetField added in v0.3.77

func (fp *BasicParser[T]) GetField() string

func (*BasicParser[T]) GetVariableRef added in v0.3.77

func (fp *BasicParser[T]) GetVariableRef() interface{}

func (*BasicParser[T]) ParseValue added in v0.3.77

func (fp *BasicParser[T]) ParseValue() (interface{}, error)

type FieldParser added in v0.3.77

type FieldParser interface {
	GetField() string
	GetVariableRef() interface{}
	ParseValue() (interface{}, error)
}

func ParserForGroup added in v0.3.77

func ParserForGroup(field string) FieldParser

func ParsersForAggregate added in v0.3.77

func ParsersForAggregate(field string, filters []*model.Filter) ([]FieldParser, error)

type FromBuilder added in v0.3.53

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

func NewFromBuilder added in v0.3.53

func NewFromBuilder(baseTable, baseTableAbbrev string) *FromBuilder

func (*FromBuilder) Build added in v0.3.53

func (b *FromBuilder) Build() string

func (*FromBuilder) Join added in v0.3.53

func (b *FromBuilder) Join(joinType JoinType, table string, abbrev string, on []string) *FromBuilder

Join specifies JOIN with other table Include multiple values in the on list to join by multiple columns Note: the columns you join on need to have the same names in both tables

type GetJobRunErrorRepository

type GetJobRunErrorRepository interface {
	GetJobRunError(ctx *armadacontext.Context, runId string) (string, error)
}

type GetJobSpecRepository

type GetJobSpecRepository interface {
	GetJobSpec(ctx *armadacontext.Context, jobId string) (*api.Job, error)
}

type GetJobsRepository

type GetJobsRepository interface {
	GetJobs(ctx *armadacontext.Context, filters []*model.Filter, order *model.Order, skip int, take int) (*GetJobsResult, error)
}

type GetJobsResult

type GetJobsResult struct {
	Jobs []*model.Job
}

type GroupByResult

type GroupByResult struct {
	Groups []*model.JobGroup
}

type GroupJobsRepository

type GroupJobsRepository interface {
	GroupBy(
		ctx *armadacontext.Context,
		filters []*model.Filter,
		order *model.Order,
		groupedField string,
		aggregates []string,
		skip int,
		take int,
	) (*GroupByResult, error)
}

type JobOptions

type JobOptions struct {
	JobId            string
	Priority         int
	PriorityClass    string
	Cpu              resource.Quantity
	Memory           resource.Quantity
	EphemeralStorage resource.Quantity
	Gpu              resource.Quantity
	Annotations      map[string]string
}

type JobSimulator

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

func NewJobSimulator

func NewJobSimulator(converter *instructions.InstructionConverter, store *lookoutdb.LookoutDb) *JobSimulator

func (*JobSimulator) ApiJob

func (js *JobSimulator) ApiJob() *api.Job

func (*JobSimulator) Build

func (js *JobSimulator) Build() *JobSimulator

func (*JobSimulator) Cancelled

func (js *JobSimulator) Cancelled(timestamp time.Time) *JobSimulator

func (*JobSimulator) Failed

func (js *JobSimulator) Failed(node string, exitCode int32, message string, timestamp time.Time) *JobSimulator

func (*JobSimulator) Job

func (js *JobSimulator) Job() *model.Job

func (*JobSimulator) Lease added in v0.3.77

func (js *JobSimulator) Lease(runId string, cluster string, node string, timestamp time.Time) *JobSimulator

func (*JobSimulator) LeaseExpired

func (js *JobSimulator) LeaseExpired(runId string, timestamp time.Time) *JobSimulator

func (*JobSimulator) LeaseReturned

func (js *JobSimulator) LeaseReturned(runId string, message string, timestamp time.Time) *JobSimulator

func (*JobSimulator) Pending

func (js *JobSimulator) Pending(runId string, cluster string, timestamp time.Time) *JobSimulator

func (*JobSimulator) Preempted added in v0.3.77

func (js *JobSimulator) Preempted(timestamp time.Time) *JobSimulator

func (*JobSimulator) Reprioritized

func (js *JobSimulator) Reprioritized(newPriority uint32, timestamp time.Time) *JobSimulator

func (*JobSimulator) RunFailed

func (js *JobSimulator) RunFailed(runId string, node string, exitCode int32, message string, timestamp time.Time) *JobSimulator

func (*JobSimulator) RunSucceeded

func (js *JobSimulator) RunSucceeded(runId string, timestamp time.Time) *JobSimulator

func (*JobSimulator) RunTerminated

func (js *JobSimulator) RunTerminated(runId string, cluster string, node string, message string, timestamp time.Time) *JobSimulator

func (*JobSimulator) RunUnschedulable

func (js *JobSimulator) RunUnschedulable(runId string, cluster string, node string, message string, timestamp time.Time) *JobSimulator

func (*JobSimulator) Running

func (js *JobSimulator) Running(runId string, node string, timestamp time.Time) *JobSimulator

func (*JobSimulator) Submit

func (js *JobSimulator) Submit(queue, jobSet, owner, namespace string, timestamp time.Time, opts *JobOptions) *JobSimulator

func (*JobSimulator) Succeeded

func (js *JobSimulator) Succeeded(timestamp time.Time) *JobSimulator

type JoinType added in v0.3.53

type JoinType string
const (
	Left  JoinType = "LEFT"
	Inner JoinType = "INNER"
)

type LastTransitionTimeParser added in v0.3.77

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

func (*LastTransitionTimeParser) GetField added in v0.3.77

func (fp *LastTransitionTimeParser) GetField() string

func (*LastTransitionTimeParser) GetVariableRef added in v0.3.77

func (fp *LastTransitionTimeParser) GetVariableRef() interface{}

func (*LastTransitionTimeParser) ParseValue added in v0.3.77

func (fp *LastTransitionTimeParser) ParseValue() (interface{}, error)

type LookoutTables

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

func NewTables

func NewTables() *LookoutTables

func (*LookoutTables) ColumnFromField

func (c *LookoutTables) ColumnFromField(field string) (string, error)

func (*LookoutTables) GroupAggregateForCol added in v0.3.50

func (c *LookoutTables) GroupAggregateForCol(col string) (AggregateType, error)

func (*LookoutTables) IsFilterable

func (c *LookoutTables) IsFilterable(col string) bool

func (*LookoutTables) IsGroupable

func (c *LookoutTables) IsGroupable(col string) bool

func (*LookoutTables) IsOrderable

func (c *LookoutTables) IsOrderable(col string) bool

func (*LookoutTables) SupportsMatch

func (c *LookoutTables) SupportsMatch(col, match string) bool

func (*LookoutTables) TableAbbrev

func (c *LookoutTables) TableAbbrev(table string) (string, error)

func (*LookoutTables) TablePrecedence

func (c *LookoutTables) TablePrecedence() []string

func (*LookoutTables) TablesForColumn

func (c *LookoutTables) TablesForColumn(col string) (map[string]bool, error)

type Query

type Query struct {
	Sql  string
	Args []interface{}
}

type QueryAggregator added in v0.3.77

type QueryAggregator interface {
	AggregateSql() (string, error)
}

func GetAggregatorsForColumn added in v0.3.77

func GetAggregatorsForColumn(queryCol *queryColumn, aggregateType AggregateType, filters []*model.Filter) ([]QueryAggregator, error)

type QueryBuilder

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

QueryBuilder is a struct responsible for building a single Lookout SQL query

func NewQueryBuilder

func NewQueryBuilder(lookoutTables *LookoutTables) *QueryBuilder

func (*QueryBuilder) CreateTempTable

func (qb *QueryBuilder) CreateTempTable() (*Query, string)

CreateTempTable creates a temporary table of job ids Returns the Query and the name of the temporary table, to be used later in InsertIntoTempTable

func (*QueryBuilder) GetJobsJsonb added in v0.4.25

func (qb *QueryBuilder) GetJobsJsonb(
	filters []*model.Filter,
	activeJobSets bool,
	order *model.Order,
	skip int,
	take int,
) (*Query, error)

func (*QueryBuilder) GroupBy

func (qb *QueryBuilder) GroupBy(
	filters []*model.Filter,
	activeJobSets bool,
	order *model.Order,
	groupedField *model.GroupedField,
	aggregates []string,
	skip int,
	take int,
) (*Query, error)

func (*QueryBuilder) GroupByJsonb added in v0.4.25

func (qb *QueryBuilder) GroupByJsonb(
	filters []*model.Filter,
	activeJobSets bool,
	order *model.Order,
	groupedField *model.GroupedField,
	aggregates []string,
	skip int,
	take int,
) (*Query, error)

func (*QueryBuilder) InsertIntoTempTable

func (qb *QueryBuilder) InsertIntoTempTable(tempTableName string, filters []*model.Filter, activeJobSets bool, order *model.Order, skip, take int) (*Query, error)

InsertIntoTempTable returns Query that returns Job IDs according to filters, order, skip and take, and inserts them in the temp table with name tempTableName

type SqlFunctionAggregator added in v0.3.77

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

func NewSqlFunctionAggregator added in v0.3.77

func NewSqlFunctionAggregator(queryCol *queryColumn, fn string) *SqlFunctionAggregator

func (*SqlFunctionAggregator) AggregateSql added in v0.3.77

func (qa *SqlFunctionAggregator) AggregateSql() (string, error)

type SqlGetJobRunErrorRepository

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

func NewSqlGetJobRunErrorRepository

func NewSqlGetJobRunErrorRepository(db *pgxpool.Pool, decompressor compress.Decompressor) *SqlGetJobRunErrorRepository

func (*SqlGetJobRunErrorRepository) GetJobRunError

func (r *SqlGetJobRunErrorRepository) GetJobRunError(ctx *armadacontext.Context, runId string) (string, error)

type SqlGetJobSpecRepository

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

func NewSqlGetJobSpecRepository

func NewSqlGetJobSpecRepository(db *pgxpool.Pool, decompressor compress.Decompressor) *SqlGetJobSpecRepository

func (*SqlGetJobSpecRepository) GetJobSpec

func (r *SqlGetJobSpecRepository) GetJobSpec(ctx *armadacontext.Context, jobId string) (*api.Job, error)

type SqlGetJobsRepository

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

func NewSqlGetJobsRepository

func NewSqlGetJobsRepository(db *pgxpool.Pool, useJsonbBackend bool) *SqlGetJobsRepository

func (*SqlGetJobsRepository) GetJobs

func (r *SqlGetJobsRepository) GetJobs(ctx *armadacontext.Context, filters []*model.Filter, activeJobSets bool, order *model.Order, skip int, take int) (*GetJobsResult, error)

type SqlGroupJobsRepository

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

func NewSqlGroupJobsRepository

func NewSqlGroupJobsRepository(db *pgxpool.Pool, useJsonbBackend bool) *SqlGroupJobsRepository

func (*SqlGroupJobsRepository) GroupBy

func (r *SqlGroupJobsRepository) GroupBy(
	ctx *armadacontext.Context,
	filters []*model.Filter,
	activeJobSets bool,
	order *model.Order,
	groupedField *model.GroupedField,
	aggregates []string,
	skip int,
	take int,
) (*GroupByResult, error)

type StateCountAggregator added in v0.3.77

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

func NewStateCountAggregator added in v0.3.77

func NewStateCountAggregator(queryCol *queryColumn, stateString string) *StateCountAggregator

func (*StateCountAggregator) AggregateSql added in v0.3.77

func (qa *StateCountAggregator) AggregateSql() (string, error)

type StateParser added in v0.3.77

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

func (*StateParser) GetField added in v0.3.77

func (fp *StateParser) GetField() string

func (*StateParser) GetVariableRef added in v0.3.77

func (fp *StateParser) GetVariableRef() interface{}

func (*StateParser) ParseValue added in v0.3.77

func (fp *StateParser) ParseValue() (interface{}, error)

type TimeParser added in v0.3.77

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

func (*TimeParser) GetField added in v0.3.77

func (fp *TimeParser) GetField() string

func (*TimeParser) GetVariableRef added in v0.3.77

func (fp *TimeParser) GetVariableRef() interface{}

func (*TimeParser) ParseValue added in v0.3.77

func (fp *TimeParser) ParseValue() (interface{}, error)

Jump to

Keyboard shortcuts

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