store

package
v0.3.27 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateNewExecution

func ValidateNewExecution(_ context.Context, execution Execution) error

Types

type ErrExecutionAlreadyExists

type ErrExecutionAlreadyExists struct {
	ExecutionID string
}

ErrExecutionAlreadyExists is returned when an execution already exists

func NewErrExecutionAlreadyExists

func NewErrExecutionAlreadyExists(id string) ErrExecutionAlreadyExists

func (ErrExecutionAlreadyExists) Error

type ErrExecutionAlreadyTerminal

type ErrExecutionAlreadyTerminal struct {
	ExecutionID string
	Actual      ExecutionState
	NewState    ExecutionState
}

ErrExecutionAlreadyTerminal is returned when an execution is already in terminal state and cannot be updated.

func NewErrExecutionAlreadyTerminal

func NewErrExecutionAlreadyTerminal(id string, actual ExecutionState, newState ExecutionState) ErrExecutionAlreadyTerminal

func (ErrExecutionAlreadyTerminal) Error

type ErrExecutionHistoryNotFound

type ErrExecutionHistoryNotFound struct {
	ExecutionID string
}

ErrExecutionHistoryNotFound is returned when the execution is not found

func NewErrExecutionHistoryNotFound

func NewErrExecutionHistoryNotFound(id string) ErrExecutionHistoryNotFound

func (ErrExecutionHistoryNotFound) Error

type ErrExecutionNotFound

type ErrExecutionNotFound struct {
	ExecutionID string
}

ErrExecutionNotFound is returned when the execution is not found

func NewErrExecutionNotFound

func NewErrExecutionNotFound(id string) ErrExecutionNotFound

func (ErrExecutionNotFound) Error

func (e ErrExecutionNotFound) Error() string

type ErrExecutionsNotFoundForJob added in v0.3.24

type ErrExecutionsNotFoundForJob struct {
	JobID string
}

ErrExecutionsNotFoundForJob is returned when the execution is not found for a given job

func NewErrExecutionsNotFoundForJob added in v0.3.24

func NewErrExecutionsNotFoundForJob(id string) ErrExecutionsNotFoundForJob

func (ErrExecutionsNotFoundForJob) Error added in v0.3.24

type ErrInvalidExecutionState

type ErrInvalidExecutionState struct {
	ExecutionID string
	Actual      ExecutionState
	Expected    ExecutionState
}

ErrInvalidExecutionState is returned when an execution is in an invalid state.

func NewErrInvalidExecutionState

func NewErrInvalidExecutionState(id string, actual ExecutionState, expected ExecutionState) ErrInvalidExecutionState

func (ErrInvalidExecutionState) Error

func (e ErrInvalidExecutionState) Error() string

type ErrInvalidExecutionVersion

type ErrInvalidExecutionVersion struct {
	ExecutionID string
	Actual      int
	Expected    int
}

ErrInvalidExecutionVersion is returned when an execution has an invalid version.

func NewErrInvalidExecutionVersion

func NewErrInvalidExecutionVersion(id string, actual int, expected int) ErrInvalidExecutionVersion

func (ErrInvalidExecutionVersion) Error

type ErrNilExecution

type ErrNilExecution struct{}

ErrNilExecution is returned when the execution is nil

func NewErrNilExecution

func NewErrNilExecution() ErrNilExecution

func (ErrNilExecution) Error

func (e ErrNilExecution) Error() string

type Execution

type Execution struct {
	ID              string
	Job             model.Job
	RequesterNodeID string
	ResourceUsage   model.ResourceUsageData
	State           ExecutionState
	Version         int
	CreateTime      time.Time
	UpdateTime      time.Time
	LatestComment   string
}

func GetActiveExecution

func GetActiveExecution(ctx context.Context, s ExecutionStore, jobID string) (Execution, error)

GetActiveExecution returns the active execution for a given job. In case of a bug where we have more than a single active execution, the latest one is returned

func NewExecution

func NewExecution(
	id string,
	job model.Job,
	requesterNodeID string,
	resourceUsage model.ResourceUsageData) *Execution

func (Execution) String

func (e Execution) String() string

string returns a string representation of the execution

type ExecutionHistory

type ExecutionHistory struct {
	ExecutionID   string
	PreviousState ExecutionState
	NewState      ExecutionState
	NewVersion    int
	Comment       string
	Time          time.Time
}

type ExecutionState

type ExecutionState int
const (
	ExecutionStateUndefined ExecutionState = iota
	ExecutionStateCreated
	ExecutionStateBidAccepted
	ExecutionStateRunning
	ExecutionStateWaitingVerification
	ExecutionStateResultAccepted
	ExecutionStatePublishing
	ExecutionStateCompleted
	ExecutionStateFailed
	ExecutionStateCancelled
)

func (ExecutionState) IsActive

func (s ExecutionState) IsActive() bool

IsActive returns true if the execution is active

func (ExecutionState) IsExecuting

func (s ExecutionState) IsExecuting() bool

IsExecuting returns true if the execution is running in the backend

func (ExecutionState) IsTerminal

func (s ExecutionState) IsTerminal() bool

IsTerminal returns true if the execution is terminal

func (ExecutionState) String

func (i ExecutionState) String() string

type ExecutionStore

type ExecutionStore interface {
	// GetExecution returns the execution for a given id
	GetExecution(ctx context.Context, id string) (Execution, error)
	// GetExecutions returns all the executions for a given job
	GetExecutions(ctx context.Context, jobID string) ([]Execution, error)
	// GetExecutionHistory returns the history of an execution
	GetExecutionHistory(ctx context.Context, id string) ([]ExecutionHistory, error)
	// CreateExecution creates a new execution for a given job
	CreateExecution(ctx context.Context, execution Execution) error
	// UpdateExecutionState updates the execution state
	UpdateExecutionState(ctx context.Context, request UpdateExecutionStateRequest) error
	// DeleteExecution deletes an execution
	DeleteExecution(ctx context.Context, id string) error
	// GetExecutionCount returns a count of all executions that completed
	// successfully on this compute node
	GetExecutionCount(ctx context.Context) (uint, error)
}

ExecutionStore A metadata store of job executions handled by the current compute node

type ExecutionSummary

type ExecutionSummary struct {
	ExecutionID   string                  `json:"ExecutionID"`
	JobID         string                  `json:"JobID"`
	State         string                  `json:"State"`
	ResourceUsage model.ResourceUsageData `json:"ResourceUsage"`
}

Summary of an execution that is used in logging and debugging.

func NewExecutionSummary

func NewExecutionSummary(execution Execution) ExecutionSummary

NewExecutionSummary generate a summary from an execution

type UpdateExecutionStateRequest

type UpdateExecutionStateRequest struct {
	ExecutionID     string
	NewState        ExecutionState
	ExpectedState   ExecutionState
	ExpectedVersion int
	Comment         string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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