Documentation ¶
Index ¶
- type AskForBidRequest
- type AskForBidResponse
- type BaseEndpoint
- func (s BaseEndpoint) AskForBid(ctx context.Context, request AskForBidRequest) (AskForBidResponse, error)
- func (s BaseEndpoint) BidAccepted(ctx context.Context, request BidAcceptedRequest) (BidAcceptedResponse, error)
- func (s BaseEndpoint) BidRejected(ctx context.Context, request BidRejectedRequest) (BidRejectedResponse, error)
- func (s BaseEndpoint) CancelExecution(ctx context.Context, request CancelExecutionRequest) (CancelExecutionResponse, error)
- func (s BaseEndpoint) ExecutionLogs(ctx context.Context, request ExecutionLogsRequest) (ExecutionLogsResponse, error)
- func (s BaseEndpoint) GetNodeID() string
- func (s BaseEndpoint) ResultAccepted(ctx context.Context, request ResultAcceptedRequest) (ResultAcceptedResponse, error)
- func (s BaseEndpoint) ResultRejected(ctx context.Context, request ResultRejectedRequest) (ResultRejectedResponse, error)
- type BaseEndpointParams
- type BaseExecutor
- type BaseExecutorParams
- type BidAcceptedRequest
- type BidAcceptedResponse
- type BidRejectedRequest
- type BidRejectedResponse
- type BidResult
- type Bidder
- type BidderParams
- type Callback
- type CallbackMock
- func (c CallbackMock) OnBidComplete(ctx context.Context, result BidResult)
- func (c CallbackMock) OnCancelComplete(ctx context.Context, result CancelResult)
- func (c CallbackMock) OnComputeFailure(ctx context.Context, err ComputeError)
- func (c CallbackMock) OnPublishComplete(ctx context.Context, result PublishResult)
- func (c CallbackMock) OnRunComplete(ctx context.Context, result RunResult)
- type CancelExecutionRequest
- type CancelExecutionResponse
- type CancelResult
- type ChainedCallback
- func (c ChainedCallback) OnBidComplete(ctx context.Context, result BidResult)
- func (c ChainedCallback) OnCancelComplete(ctx context.Context, result CancelResult)
- func (c ChainedCallback) OnComputeFailure(ctx context.Context, err ComputeError)
- func (c ChainedCallback) OnPublishComplete(ctx context.Context, result PublishResult)
- func (c ChainedCallback) OnRunComplete(ctx context.Context, result RunResult)
- type ChainedCallbackParams
- type ComputeError
- type Endpoint
- type ExecutionLogsRequest
- type ExecutionLogsResponse
- type ExecutionMetadata
- type Executor
- type ExecutorBuffer
- func (s *ExecutorBuffer) Cancel(_ context.Context, execution store.Execution) error
- func (s *ExecutorBuffer) EnqueuedExecutions() []store.Execution
- func (s *ExecutorBuffer) Publish(_ context.Context, execution store.Execution) error
- func (s *ExecutorBuffer) Run(ctx context.Context, execution store.Execution) (err error)
- func (s *ExecutorBuffer) RunningExecutions() []store.Execution
- type ExecutorBufferParams
- type MockCallback
- func (m *MockCallback) OnBidComplete(ctx context.Context, result BidResult)
- func (m *MockCallback) OnCancelComplete(ctx context.Context, result CancelResult)
- func (m *MockCallback) OnComputeFailure(ctx context.Context, failure ComputeError)
- func (m *MockCallback) OnPublishComplete(ctx context.Context, result PublishResult)
- func (m *MockCallback) OnRunComplete(ctx context.Context, result RunResult)
- type NodeInfoProvider
- type NodeInfoProviderParams
- type PublishResult
- type ResultAcceptedRequest
- type ResultAcceptedResponse
- type ResultRejectedRequest
- type ResultRejectedResponse
- type RoutingMetadata
- type RunResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AskForBidRequest ¶
type AskForBidRequest struct { ExecutionMetadata RoutingMetadata // Job specifies the job to be executed. Job model.Job }
type AskForBidResponse ¶
type AskForBidResponse struct {
ExecutionMetadata
}
type BaseEndpoint ¶
type BaseEndpoint struct {
// contains filtered or unexported fields
}
Base implementation of Endpoint
func NewBaseEndpoint ¶
func NewBaseEndpoint(params BaseEndpointParams) BaseEndpoint
func (BaseEndpoint) AskForBid ¶
func (s BaseEndpoint) AskForBid(ctx context.Context, request AskForBidRequest) (AskForBidResponse, error)
func (BaseEndpoint) BidAccepted ¶
func (s BaseEndpoint) BidAccepted(ctx context.Context, request BidAcceptedRequest) (BidAcceptedResponse, error)
func (BaseEndpoint) BidRejected ¶
func (s BaseEndpoint) BidRejected(ctx context.Context, request BidRejectedRequest) (BidRejectedResponse, error)
func (BaseEndpoint) CancelExecution ¶
func (s BaseEndpoint) CancelExecution(ctx context.Context, request CancelExecutionRequest) (CancelExecutionResponse, error)
func (BaseEndpoint) ExecutionLogs ¶ added in v0.3.26
func (s BaseEndpoint) ExecutionLogs(ctx context.Context, request ExecutionLogsRequest) (ExecutionLogsResponse, error)
func (BaseEndpoint) GetNodeID ¶
func (s BaseEndpoint) GetNodeID() string
func (BaseEndpoint) ResultAccepted ¶
func (s BaseEndpoint) ResultAccepted(ctx context.Context, request ResultAcceptedRequest) (ResultAcceptedResponse, error)
func (BaseEndpoint) ResultRejected ¶
func (s BaseEndpoint) ResultRejected(ctx context.Context, request ResultRejectedRequest) (ResultRejectedResponse, error)
type BaseEndpointParams ¶
type BaseEndpointParams struct { ID string ExecutionStore store.ExecutionStore UsageCalculator capacity.UsageCalculator Bidder Bidder Executor Executor LogServer logstream.LogStreamServer }
type BaseExecutor ¶
type BaseExecutor struct { ID string // contains filtered or unexported fields }
BaseExecutor is the base implementation for backend service. All operations are executed asynchronously, and a callback is used to notify the caller of the result.
func NewBaseExecutor ¶
func NewBaseExecutor(params BaseExecutorParams) *BaseExecutor
type BaseExecutorParams ¶
type BaseExecutorParams struct { ID string Callback Callback Store store.ExecutionStore Executors executor.ExecutorProvider Verifiers verifier.VerifierProvider Publishers publisher.PublisherProvider SimulatorConfig model.SimulatorConfigCompute }
type BidAcceptedRequest ¶
type BidAcceptedRequest struct { RoutingMetadata ExecutionID string Accepted bool Justification string }
type BidAcceptedResponse ¶
type BidAcceptedResponse struct {
ExecutionMetadata
}
type BidRejectedRequest ¶
type BidRejectedRequest struct { RoutingMetadata ExecutionID string Justification string }
type BidRejectedResponse ¶
type BidRejectedResponse struct {
ExecutionMetadata
}
type BidResult ¶ added in v0.3.26
type BidResult struct { RoutingMetadata ExecutionMetadata Accepted bool Reason string }
BidResult is the result of the compute node bidding on a job that is returned to the caller through a Callback.
type Bidder ¶ added in v0.3.26
type Bidder struct {
// contains filtered or unexported fields
}
func NewBidder ¶ added in v0.3.26
func NewBidder(params BidderParams) Bidder
func (Bidder) ReturnBidResult ¶ added in v0.3.26
func (b Bidder) ReturnBidResult(ctx context.Context, execution store.Execution, response *bidstrategy.BidStrategyResponse)
func (Bidder) RunBidding ¶ added in v0.3.26
func (b Bidder) RunBidding(ctx context.Context, request AskForBidRequest, usageCalc capacity.UsageCalculator)
type BidderParams ¶ added in v0.3.26
type BidderParams struct { NodeID string SemanticStrategy bidstrategy.SemanticBidStrategy ResourceStrategy bidstrategy.ResourceBidStrategy Store store.ExecutionStore Callback Callback GetApproveURL func() *url.URL }
type Callback ¶
type Callback interface { OnBidComplete(ctx context.Context, result BidResult) OnRunComplete(ctx context.Context, result RunResult) OnPublishComplete(ctx context.Context, result PublishResult) OnCancelComplete(ctx context.Context, result CancelResult) OnComputeFailure(ctx context.Context, err ComputeError) }
Callback Callbacks are used to notify the caller of the result of a job execution.
type CallbackMock ¶ added in v0.3.26
type CallbackMock struct { OnBidCompleteHandler func(ctx context.Context, result BidResult) OnCancelCompleteHandler func(ctx context.Context, result CancelResult) OnComputeFailureHandler func(ctx context.Context, err ComputeError) OnPublishCompleteHandler func(ctx context.Context, result PublishResult) OnRunCompleteHandler func(ctx context.Context, result RunResult) }
func (CallbackMock) OnBidComplete ¶ added in v0.3.26
func (c CallbackMock) OnBidComplete(ctx context.Context, result BidResult)
OnBidComplete implements Callback
func (CallbackMock) OnCancelComplete ¶ added in v0.3.26
func (c CallbackMock) OnCancelComplete(ctx context.Context, result CancelResult)
OnCancelComplete implements Callback
func (CallbackMock) OnComputeFailure ¶ added in v0.3.26
func (c CallbackMock) OnComputeFailure(ctx context.Context, err ComputeError)
OnComputeFailure implements Callback
func (CallbackMock) OnPublishComplete ¶ added in v0.3.26
func (c CallbackMock) OnPublishComplete(ctx context.Context, result PublishResult)
OnPublishComplete implements Callback
func (CallbackMock) OnRunComplete ¶ added in v0.3.26
func (c CallbackMock) OnRunComplete(ctx context.Context, result RunResult)
OnRunComplete implements Callback
type CancelExecutionRequest ¶
type CancelExecutionRequest struct { RoutingMetadata ExecutionID string Justification string }
type CancelExecutionResponse ¶
type CancelExecutionResponse struct {
ExecutionMetadata
}
type CancelResult ¶
type CancelResult struct { RoutingMetadata ExecutionMetadata }
CancelResult Result of a job cancel that is returned to the caller through a Callback.
type ChainedCallback ¶
type ChainedCallback struct {
// contains filtered or unexported fields
}
ChainedCallback Callback that chains multiple callbacks and delegates the calls to them.
func NewChainedCallback ¶
func NewChainedCallback(params ChainedCallbackParams) *ChainedCallback
func (ChainedCallback) OnBidComplete ¶ added in v0.3.26
func (c ChainedCallback) OnBidComplete(ctx context.Context, result BidResult)
func (ChainedCallback) OnCancelComplete ¶
func (c ChainedCallback) OnCancelComplete(ctx context.Context, result CancelResult)
func (ChainedCallback) OnComputeFailure ¶
func (c ChainedCallback) OnComputeFailure(ctx context.Context, err ComputeError)
func (ChainedCallback) OnPublishComplete ¶
func (c ChainedCallback) OnPublishComplete(ctx context.Context, result PublishResult)
func (ChainedCallback) OnRunComplete ¶
func (c ChainedCallback) OnRunComplete(ctx context.Context, result RunResult)
type ChainedCallbackParams ¶
type ChainedCallbackParams struct {
Callbacks []Callback
}
type ComputeError ¶
type ComputeError struct { RoutingMetadata ExecutionMetadata Err string }
func (ComputeError) Error ¶
func (e ComputeError) Error() string
type Endpoint ¶
type Endpoint interface { // AskForBid asks for a bid for a given job, which will assign executionID to the job and return a bid // is interested in bidding on. AskForBid(context.Context, AskForBidRequest) (AskForBidResponse, error) // BidAccepted accepts a bid for a given executionID, which will trigger executing the job in the backend. // The execution can be synchronous or asynchronous, depending on the backend implementation. BidAccepted(context.Context, BidAcceptedRequest) (BidAcceptedResponse, error) // BidRejected rejects a bid for a given executionID. BidRejected(context.Context, BidRejectedRequest) (BidRejectedResponse, error) // ResultAccepted accepts a result for a given executionID, which will trigger publishing the result to the // destination specified in the job. ResultAccepted(context.Context, ResultAcceptedRequest) (ResultAcceptedResponse, error) // ResultRejected rejects a result for a given executionID. ResultRejected(context.Context, ResultRejectedRequest) (ResultRejectedResponse, error) // CancelExecution cancels a job for a given executionID. CancelExecution(context.Context, CancelExecutionRequest) (CancelExecutionResponse, error) // ExecutionLogs returns the address of a suitable log server ExecutionLogs(context.Context, ExecutionLogsRequest) (ExecutionLogsResponse, error) }
Endpoint is the frontend and entry point to the compute node. Requesters, whether through API, CLI or other means, do interact with the frontend service to submit jobs, ask for bids, accept or reject bids, etc.
type ExecutionLogsRequest ¶ added in v0.3.26
type ExecutionLogsRequest struct { RoutingMetadata ExecutionID string WithHistory bool Follow bool }
type ExecutionLogsResponse ¶ added in v0.3.26
type ExecutionMetadata ¶
func NewExecutionMetadata ¶
func NewExecutionMetadata(execution store.Execution) ExecutionMetadata
type Executor ¶
type Executor interface { // Run triggers the execution of a job. Run(ctx context.Context, execution store.Execution) error // Publish publishes the result of a job execution. Publish(ctx context.Context, execution store.Execution) error // Cancel cancels the execution of a job. Cancel(ctx context.Context, execution store.Execution) error }
Executor Backend service that is responsible for running and publishing executions. Implementations can be synchronous or asynchronous by using Callbacks.
type ExecutorBuffer ¶
type ExecutorBuffer struct { ID string // contains filtered or unexported fields }
ExecutorBuffer is a backend.Executor implementation that buffers executions locally until enough capacity is available to be able to run them. The buffer accepts a delegate backend.Executor that will be used to run the jobs. The buffer is implemented as a FIFO queue, where the order of the executions is determined by the order in which they were enqueued. However, an execution with high resource usage requirements might be skipped if there are newer jobs with lower resource usage requirements that can be executed immediately. This is done to improve utilization of compute nodes, though it might result in starvation and should be re-evaluated in the future.
func NewExecutorBuffer ¶
func NewExecutorBuffer(params ExecutorBufferParams) *ExecutorBuffer
func (*ExecutorBuffer) EnqueuedExecutions ¶
func (s *ExecutorBuffer) EnqueuedExecutions() []store.Execution
EnqueuedExecutions return list of enqueued executions
func (*ExecutorBuffer) Run ¶
Run enqueues the execution and tries to run it if there is enough capacity.
func (*ExecutorBuffer) RunningExecutions ¶
func (s *ExecutorBuffer) RunningExecutions() []store.Execution
RunningExecutions return list of running executions
type ExecutorBufferParams ¶
type MockCallback ¶ added in v1.0.0
func (*MockCallback) OnBidComplete ¶ added in v1.0.0
func (m *MockCallback) OnBidComplete(ctx context.Context, result BidResult)
func (*MockCallback) OnCancelComplete ¶ added in v1.0.0
func (m *MockCallback) OnCancelComplete(ctx context.Context, result CancelResult)
func (*MockCallback) OnComputeFailure ¶ added in v1.0.0
func (m *MockCallback) OnComputeFailure(ctx context.Context, failure ComputeError)
func (*MockCallback) OnPublishComplete ¶ added in v1.0.0
func (m *MockCallback) OnPublishComplete(ctx context.Context, result PublishResult)
func (*MockCallback) OnRunComplete ¶ added in v1.0.0
func (m *MockCallback) OnRunComplete(ctx context.Context, result RunResult)
type NodeInfoProvider ¶
type NodeInfoProvider struct {
// contains filtered or unexported fields
}
func NewNodeInfoProvider ¶
func NewNodeInfoProvider(params NodeInfoProviderParams) *NodeInfoProvider
func (*NodeInfoProvider) GetComputeInfo ¶
func (n *NodeInfoProvider) GetComputeInfo(ctx context.Context) model.ComputeNodeInfo
type NodeInfoProviderParams ¶
type NodeInfoProviderParams struct { Executors executor.ExecutorProvider Verifiers verifier.VerifierProvider Publisher publisher.PublisherProvider Storages storage.StorageProvider CapacityTracker capacity.Tracker ExecutorBuffer *ExecutorBuffer MaxJobRequirements model.ResourceUsageData }
type PublishResult ¶
type PublishResult struct { RoutingMetadata ExecutionMetadata PublishResult model.StorageSpec }
PublishResult Result of a job publish that is returned to the caller through a Callback.
type ResultAcceptedRequest ¶
type ResultAcceptedRequest struct { RoutingMetadata ExecutionID string }
type ResultAcceptedResponse ¶
type ResultAcceptedResponse struct {
ExecutionMetadata
}
type ResultRejectedRequest ¶
type ResultRejectedRequest struct { RoutingMetadata ExecutionID string Justification string }
type ResultRejectedResponse ¶
type ResultRejectedResponse struct {
ExecutionMetadata
}
type RoutingMetadata ¶
type RunResult ¶
type RunResult struct { RoutingMetadata ExecutionMetadata ResultProposal []byte RunCommandResult *model.RunCommandResult }
RunResult Result of a job execution that is returned to the caller through a Callback.