Documentation ¶
Index ¶
- func ValidateNewExecution(_ context.Context, execution Execution) error
- type ErrExecutionAlreadyExists
- type ErrExecutionAlreadyTerminal
- type ErrExecutionHistoryNotFound
- type ErrExecutionNotFound
- type ErrExecutionsNotFoundForShard
- type ErrInvalidExecutionState
- type ErrInvalidExecutionVersion
- type ErrNilExecution
- type Execution
- type ExecutionHistory
- type ExecutionState
- type ExecutionStore
- type ExecutionSummary
- type UpdateExecutionStateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
func (e ErrExecutionAlreadyExists) Error() string
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 ¶
func (e ErrExecutionAlreadyTerminal) Error() string
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 ¶
func (e ErrExecutionHistoryNotFound) Error() string
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 ErrExecutionsNotFoundForShard ¶
type ErrExecutionsNotFoundForShard struct {
ShardID string
}
ErrExecutionNotFound is returned when the execution is not found
func NewErrExecutionsNotFound ¶
func NewErrExecutionsNotFound(id string) ErrExecutionsNotFoundForShard
func (ErrExecutionsNotFoundForShard) Error ¶
func (e ErrExecutionsNotFoundForShard) Error() string
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 ¶
ErrInvalidExecutionVersion is returned when an execution has an invalid version.
func NewErrInvalidExecutionVersion ¶
func NewErrInvalidExecutionVersion(id string, actual int, expected int) ErrInvalidExecutionVersion
func (ErrInvalidExecutionVersion) Error ¶
func (e ErrInvalidExecutionVersion) Error() string
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 Shard model.JobShard RequesterNodeID string ResourceUsage model.ResourceUsageData State ExecutionState Version int CreateTime time.Time UpdateTime time.Time LatestComment string }
func GetActiveExecution ¶
GetActiveExecution returns the active execution for a given shard. In case of a bug where we have more than a single active execution, the latest one is returned
func NewExecution ¶
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 shard GetExecutions(ctx context.Context, sharedID 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 shard 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 }
ExecutionStore A metadata store of job executions handled by the current compute node
type ExecutionSummary ¶
type ExecutionSummary struct { ExecutionID string `json:"ExecutionID"` ShardID string `json:"ShardID"` 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 }