Documentation ¶
Overview ¶
Package bidstrategy is a generated GoMock package.
Index ¶
- func FormatReason(success bool, jobRequiresNodeTo string, fmtArgs ...any) string
- type BidStrategy
- type BidStrategyRequest
- type BidStrategyResponse
- type CallbackBidStrategy
- type ChainedBidStrategy
- func (c *ChainedBidStrategy) AddStrategy(opts ...StrategyOpt)
- func (c *ChainedBidStrategy) ShouldBid(ctx context.Context, request BidStrategyRequest) (BidStrategyResponse, error)
- func (c *ChainedBidStrategy) ShouldBidBasedOnUsage(ctx context.Context, request BidStrategyRequest, usage models.Resources) (BidStrategyResponse, error)
- type JobSelectionPolicyProbeData
- type MockBidStrategy
- func (m *MockBidStrategy) EXPECT() *MockBidStrategyMockRecorder
- func (m *MockBidStrategy) ShouldBid(ctx context.Context, request BidStrategyRequest) (BidStrategyResponse, error)
- func (m *MockBidStrategy) ShouldBidBasedOnUsage(ctx context.Context, request BidStrategyRequest, usage models.Resources) (BidStrategyResponse, error)
- type MockBidStrategyMockRecorder
- type MockResourceBidStrategy
- type MockResourceBidStrategyMockRecorder
- type MockSemanticBidStrategy
- type MockSemanticBidStrategyMockRecorder
- type ModerateJobRequest
- type ResourceBidStrategy
- type SemanticBidStrategy
- type StrategyOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BidStrategy ¶
type BidStrategy interface { SemanticBidStrategy ResourceBidStrategy }
func NewWaitingStrategy ¶ added in v0.3.26
func NewWaitingStrategy(underlying BidStrategy, waitOnBid, waitOnNoBid bool) BidStrategy
type BidStrategyRequest ¶
type BidStrategyResponse ¶
type BidStrategyResponse struct { ShouldBid bool `json:"shouldBid"` ShouldWait bool `json:"shouldWait"` Reason string `json:"reason"` }
func NewBidResponse ¶ added in v1.1.5
func NewBidResponse(success bool, jobRequiresNodeTo string, fmtArgs ...any) BidStrategyResponse
type CallbackBidStrategy ¶ added in v0.3.26
type CallbackBidStrategy struct { OnShouldBid func(context.Context, BidStrategyRequest) (BidStrategyResponse, error) OnShouldBidBasedOnUsage func(context.Context, BidStrategyRequest, models.Resources) (BidStrategyResponse, error) }
func NewFixedBidStrategy ¶ added in v0.3.25
func NewFixedBidStrategy(response, wait bool) *CallbackBidStrategy
FixedBidStrategy is a bid strategy that always returns the same response, which is useful for testing
func (*CallbackBidStrategy) ShouldBid ¶ added in v0.3.26
func (s *CallbackBidStrategy) ShouldBid(ctx context.Context, request BidStrategyRequest) (BidStrategyResponse, error)
ShouldBid implements BidStrategy
func (*CallbackBidStrategy) ShouldBidBasedOnUsage ¶ added in v0.3.26
func (s *CallbackBidStrategy) ShouldBidBasedOnUsage( ctx context.Context, request BidStrategyRequest, resourceUsage models.Resources, ) (BidStrategyResponse, error)
ShouldBidBasedOnUsage implements BidStrategy
type ChainedBidStrategy ¶
type ChainedBidStrategy struct { Semantics []SemanticBidStrategy Resources []ResourceBidStrategy }
func NewChainedBidStrategy ¶
func NewChainedBidStrategy(opts ...StrategyOpt) *ChainedBidStrategy
func (*ChainedBidStrategy) AddStrategy ¶
func (c *ChainedBidStrategy) AddStrategy(opts ...StrategyOpt)
AddStrategy Add new strategy to the end of the chain NOTE: this is not thread safe.
func (*ChainedBidStrategy) ShouldBid ¶
func (c *ChainedBidStrategy) ShouldBid(ctx context.Context, request BidStrategyRequest) (BidStrategyResponse, error)
ShouldBid Iterate over all strategies, and return shouldBid if no error is thrown and none of the strategies return should not bid.
func (*ChainedBidStrategy) ShouldBidBasedOnUsage ¶
func (c *ChainedBidStrategy) ShouldBidBasedOnUsage( ctx context.Context, request BidStrategyRequest, usage models.Resources) (BidStrategyResponse, error)
ShouldBidBasedOnUsage Iterate over all strategies, and return shouldBid if no error is thrown and none of the strategies return should not bid.
type JobSelectionPolicyProbeData ¶
type JobSelectionPolicyProbeData struct { NodeID string `json:"NodeID"` Job models.Job `json:"Job"` Callback *url.URL `json:"Callback"` }
the JSON data we send to http or exec probes TODO: can we just use the BidStrategyRequest struct?
func GetJobSelectionPolicyProbeData ¶ added in v1.0.0
func GetJobSelectionPolicyProbeData(request BidStrategyRequest) JobSelectionPolicyProbeData
Return JobSelectionPolicyProbeData for the given request
type MockBidStrategy ¶ added in v1.0.4
type MockBidStrategy struct {
// contains filtered or unexported fields
}
MockBidStrategy is a mock of BidStrategy interface.
func NewMockBidStrategy ¶ added in v1.0.4
func NewMockBidStrategy(ctrl *gomock.Controller) *MockBidStrategy
NewMockBidStrategy creates a new mock instance.
func (*MockBidStrategy) EXPECT ¶ added in v1.0.4
func (m *MockBidStrategy) EXPECT() *MockBidStrategyMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockBidStrategy) ShouldBid ¶ added in v1.0.4
func (m *MockBidStrategy) ShouldBid(ctx context.Context, request BidStrategyRequest) (BidStrategyResponse, error)
ShouldBid mocks base method.
func (*MockBidStrategy) ShouldBidBasedOnUsage ¶ added in v1.0.4
func (m *MockBidStrategy) ShouldBidBasedOnUsage(ctx context.Context, request BidStrategyRequest, usage models.Resources) (BidStrategyResponse, error)
ShouldBidBasedOnUsage mocks base method.
type MockBidStrategyMockRecorder ¶ added in v1.0.4
type MockBidStrategyMockRecorder struct {
// contains filtered or unexported fields
}
MockBidStrategyMockRecorder is the mock recorder for MockBidStrategy.
func (*MockBidStrategyMockRecorder) ShouldBid ¶ added in v1.0.4
func (mr *MockBidStrategyMockRecorder) ShouldBid(ctx, request any) *gomock.Call
ShouldBid indicates an expected call of ShouldBid.
func (*MockBidStrategyMockRecorder) ShouldBidBasedOnUsage ¶ added in v1.0.4
func (mr *MockBidStrategyMockRecorder) ShouldBidBasedOnUsage(ctx, request, usage any) *gomock.Call
ShouldBidBasedOnUsage indicates an expected call of ShouldBidBasedOnUsage.
type MockResourceBidStrategy ¶ added in v1.0.4
type MockResourceBidStrategy struct {
// contains filtered or unexported fields
}
MockResourceBidStrategy is a mock of ResourceBidStrategy interface.
func NewMockResourceBidStrategy ¶ added in v1.0.4
func NewMockResourceBidStrategy(ctrl *gomock.Controller) *MockResourceBidStrategy
NewMockResourceBidStrategy creates a new mock instance.
func (*MockResourceBidStrategy) EXPECT ¶ added in v1.0.4
func (m *MockResourceBidStrategy) EXPECT() *MockResourceBidStrategyMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockResourceBidStrategy) ShouldBidBasedOnUsage ¶ added in v1.0.4
func (m *MockResourceBidStrategy) ShouldBidBasedOnUsage(ctx context.Context, request BidStrategyRequest, usage models.Resources) (BidStrategyResponse, error)
ShouldBidBasedOnUsage mocks base method.
type MockResourceBidStrategyMockRecorder ¶ added in v1.0.4
type MockResourceBidStrategyMockRecorder struct {
// contains filtered or unexported fields
}
MockResourceBidStrategyMockRecorder is the mock recorder for MockResourceBidStrategy.
func (*MockResourceBidStrategyMockRecorder) ShouldBidBasedOnUsage ¶ added in v1.0.4
func (mr *MockResourceBidStrategyMockRecorder) ShouldBidBasedOnUsage(ctx, request, usage any) *gomock.Call
ShouldBidBasedOnUsage indicates an expected call of ShouldBidBasedOnUsage.
type MockSemanticBidStrategy ¶ added in v1.0.4
type MockSemanticBidStrategy struct {
// contains filtered or unexported fields
}
MockSemanticBidStrategy is a mock of SemanticBidStrategy interface.
func NewMockSemanticBidStrategy ¶ added in v1.0.4
func NewMockSemanticBidStrategy(ctrl *gomock.Controller) *MockSemanticBidStrategy
NewMockSemanticBidStrategy creates a new mock instance.
func (*MockSemanticBidStrategy) EXPECT ¶ added in v1.0.4
func (m *MockSemanticBidStrategy) EXPECT() *MockSemanticBidStrategyMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSemanticBidStrategy) ShouldBid ¶ added in v1.0.4
func (m *MockSemanticBidStrategy) ShouldBid(ctx context.Context, request BidStrategyRequest) (BidStrategyResponse, error)
ShouldBid mocks base method.
type MockSemanticBidStrategyMockRecorder ¶ added in v1.0.4
type MockSemanticBidStrategyMockRecorder struct {
// contains filtered or unexported fields
}
MockSemanticBidStrategyMockRecorder is the mock recorder for MockSemanticBidStrategy.
type ModerateJobRequest ¶ added in v0.3.26
type ModerateJobRequest struct { ClientID string JobID string Response BidStrategyResponse }
func (ModerateJobRequest) GetClientID ¶ added in v0.3.26
func (mjr ModerateJobRequest) GetClientID() string
type ResourceBidStrategy ¶ added in v1.0.0
type ResourceBidStrategy interface {
ShouldBidBasedOnUsage(ctx context.Context, request BidStrategyRequest, usage models.Resources) (BidStrategyResponse, error)
}
type SemanticBidStrategy ¶ added in v1.0.0
type SemanticBidStrategy interface {
ShouldBid(ctx context.Context, request BidStrategyRequest) (BidStrategyResponse, error)
}
type StrategyOpt ¶ added in v1.0.0
type StrategyOpt func(strategy *ChainedBidStrategy)
func WithResources ¶ added in v1.0.0
func WithResources(strategy ...ResourceBidStrategy) StrategyOpt
func WithSemantics ¶ added in v1.0.0
func WithSemantics(strategy ...SemanticBidStrategy) StrategyOpt