Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Algorithms = map[string]AlgorithmInterface{} // Operator Actions TerminateAction = "terminate" CompleteAction = "complete" ScaleAction = "scale" ResetCounterAction = "resetCounter" JobsMatrixUpdateAction = "updateJobsMatrix" // Queue actions SubmitAction = "submit" JobInfoAction = "jobinfo" )
A lookup of registered algorithms by name
Functions ¶
Types ¶
type AlgorithmDecision ¶
type AlgorithmDecision struct { // Scale up or down by size (e.g., negative value is size) Scale int32 `json:"scale"` // Send payload back to gRPC sidecar service Payload string `json:"payload"` // Action to ask the queue or operator to take Action string `json:"action"` // Jobs matrix Jobs []api.Job }
An algorithm must return a decision for the operator to take
func (*AlgorithmDecision) IsQueueRequest ¶
func (a *AlgorithmDecision) IsQueueRequest() bool
IsQueueRequest determines if the action should be sent to the queue Right now this is only the submit action
func (*AlgorithmDecision) ToJson ¶
func (e *AlgorithmDecision) ToJson() (string, error)
ToJson serializes to json
type AlgorithmInterface ¶
type AlgorithmInterface interface { Name() string Description() string // Let's assume an algorithm can make a decision based on the gRPC payload MakeDecision(*api.Ensemble, *api.Member, interface{}, []api.Job) (AlgorithmDecision, error) Validate(AlgorithmOptions) bool // Check that an algorithm is supported for a member type, and the member is valid Check(AlgorithmOptions, *api.Member) error }
An algorithm interface determines behavior for scaling and termination. Each algorithm can interact with the member gRPC client to:
get a current state or other metadata required to make a decision directly influence the queue and submission (advanced)
func GetOrFail ¶
func GetOrFail(name string) AlgorithmInterface
GetOrFail ensures we can find the entry
type AlgorithmOptions ¶
type AlgorithmOptions map[string]intstr.IntOrString
AlgorithmOptions allow packaging named values of different types This is an alternative to using interfaces.
Click to show internal directories.
Click to hide internal directories.