Documentation ¶
Index ¶
- type AskForBidRequest
- type AskForBidResponse
- type AskForBidShardResponse
- 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) 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 Callback
- type CancelExecutionRequest
- type CancelExecutionResponse
- type CancelResult
- type ChainedCallback
- 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 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 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 { RoutingMetadata // Job specifies the job to be executed. Job model.Job // ShardIndexes specifies the shard indexes to be executed. // This enables the requester to ask for bids for a subset of the shards of a job. ShardIndexes []int }
type AskForBidResponse ¶
type AskForBidResponse struct {
ShardResponse []AskForBidShardResponse
}
type AskForBidShardResponse ¶
type AskForBidShardResponse struct { ExecutionMetadata Accepted bool Reason string }
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) 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 BidStrategy bidstrategy.BidStrategy Executor Executor }
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 Callback ¶
type Callback interface { 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 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) 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 and shard IDs, which will assign executionIDs for each shard the node // 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) }
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 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 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 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.