Documentation ¶
Index ¶
- Constants
- Variables
- func GetErrorFromCode(apiErr Error) error
- func PredictPCFnDummy(_ context.Context, mcpu int, status NodeStatus) (float64, error)
- func RequestToEstimatorName(ns, name string) string
- type AuthenticationFunc
- type Client
- type ClientOption
- type ComputeLeastCostPatternsFunc
- type ComputeLeastCostsFunc
- type Error
- type Estimator
- type Estimators
- type FakeNodeMonitor
- type FakePCPredictor
- type MLServerPCPredictor
- type Node
- type NodeMonitor
- type NodeStatus
- type Nodes
- type PowerConsumption
- type PowerConsumptionPredictor
- type RedfishNodeMonitor
- type Server
- func (s *Server) Handler(middlewares ...func(http.Handler) http.Handler) (http.Handler, error)
- func (s *Server) HandlerWithAuthFn(authFn AuthenticationFunc, middlewares ...func(http.Handler) http.Handler) (http.Handler, error)
- func (s *Server) PostNamespacesNsEstimatorsNameValuesPowerconsumption(ctx context.Context, ...) (api.PostNamespacesNsEstimatorsNameValuesPowerconsumptionResponseObject, error)
Constants ¶
View Source
const AuthFnAPIKeyRequestHeader = "X-API-KEY"
View Source
const ServerDefaultPort = 5656
Variables ¶
View Source
var ( ErrUnexpected = errors.New("ErrUnexpected") ErrServerEstimatorNotFound = errors.New("ErrServerEstimatorNotFound") ErrEstimator = errors.New("ErrEstimator") ErrEstimatorNoNodesAvailable = errors.New("ErrEstimatorNoNodesAvailable") ErrEstimatorInvalidRequest = errors.New("ErrEstimatorInvalidRequest") ErrNodeMonitor = errors.New("ErrNodeMonitor") ErrNodeMonitorNotFound = errors.New("ErrNodeMonitorNotFound") ErrNodeStatus = errors.New("ErrNodeStatus") ErrPCPredictor = errors.New("ErrPCPredictor") ErrPCPredictorNotFound = errors.New("ErrPCPredictorNotFound") )
View Source
var ComputeLeastCostPatternsFn = findLeastCostPatternsExhaustiveWithSampling
View Source
var ComputeLeastCostsFn = findLeastCosts
Functions ¶
func GetErrorFromCode ¶
func PredictPCFnDummy ¶
PredictPCFnDummy returns ( mCPU/100 + avg(CPUUsage) + avg(AmbientTemp) )
func RequestToEstimatorName ¶
Types ¶
type AuthenticationFunc ¶
type AuthenticationFunc = openapi3filter.AuthenticationFunc
func AuthFnAPIKey ¶
func AuthFnAPIKey(apiKeys map[string]struct{}) AuthenticationFunc
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(server string, estimatorNamespace, estimatorName string, opts ...ClientOption) (*Client, error)
func (*Client) EstimatePowerConsumption ¶
type ClientOption ¶
type ClientOption = api.ClientOption
func ClientOptionAddRequestHeader ¶
func ClientOptionAddRequestHeader(k, v string) ClientOption
func ClientOptionGetRequestAsCurl ¶
func ClientOptionGetRequestAsCurl(w io.Writer) ClientOption
type ComputeLeastCostsFunc ¶
type Estimator ¶
type Estimator struct { Nodes *Nodes // contains filtered or unexported fields }
func (*Estimator) EstimatePowerConsumption ¶
func (e *Estimator) EstimatePowerConsumption(ctx context.Context, cpuMilli, numWorkloads int) ([]float64, error)
EstimatePowerConsumption is a thread-safe function that estimates power consumption with the given parameters.
+Inf in the response represents errors in Node.GetStatus or PowerConsumptionPredictor.Predict. The response will not contain -Inf or NaN, return an error instead if -Inf or NaN is encountered.
type Estimators ¶
type Estimators struct {
// contains filtered or unexported fields
}
func (*Estimators) Delete ¶
func (m *Estimators) Delete(k string)
func (*Estimators) Len ¶
func (m *Estimators) Len() int
type FakeNodeMonitor ¶
type FakeNodeMonitor struct {
FetchFunc func(ctx context.Context) (NodeStatus, error)
}
func (*FakeNodeMonitor) FetchStatus ¶
func (m *FakeNodeMonitor) FetchStatus(ctx context.Context) (NodeStatus, error)
type FakePCPredictor ¶
type FakePCPredictor struct {
PredictFunc func(ctx context.Context, requestCPUMilli int, status NodeStatus) (watt float64, err error)
}
func (*FakePCPredictor) Predict ¶
func (p *FakePCPredictor) Predict(ctx context.Context, requestCPUMilli int, status NodeStatus) (watt float64, err error)
type MLServerPCPredictor ¶
type MLServerPCPredictor struct { }
func (*MLServerPCPredictor) Predict ¶
func (p *MLServerPCPredictor) Predict(ctx context.Context, requestCPUMilli int, status NodeStatus) (watt float64, err error)
type Node ¶
type Node struct { Name string // contains filtered or unexported fields }
func NewNode ¶
func NewNode(name string, nm NodeMonitor, nodeStatusRefreshInterval time.Duration, pcp PowerConsumptionPredictor) *Node
func (*Node) FetchStatus ¶
func (n *Node) FetchStatus(ctx context.Context) (NodeStatus, error)
func (*Node) GetStatus ¶
func (n *Node) GetStatus() NodeStatus
type NodeMonitor ¶
type NodeMonitor interface {
FetchStatus(ctx context.Context) (NodeStatus, error)
}
type NodeStatus ¶
type NodeStatus struct { Timestamp time.Time // CPUSockets is the number of sockets the node has. // e.g. 2 CPUSockets int // CPUCores is the number of cores per CPU. // e.g. 4 CPUCores int // CPUUsages is the list of CPU usages per core. // e.g. [[10.0, 10.0, 10.0, 10.0], [20.0, 20.0, 20.0, 20.0]] CPUUsages [][]float64 // CPUTemps is the list of CPU temperatures in Celsius per core. // e.g. [[30.0, 30.0, 30.0, 30.0], [50.0, 50.0, 50.0, 50.0]] CPUTemps [][]float64 // AmbientSensors is the number of ambient temperature sensors the node has. // e.g. 4 AmbientSensors int // AmbientTemps is the list of temperatures in Celsius. // e.g. [20.0, 20.0, 20.0, 20.0] AmbientTemps []float64 }
func (*NodeStatus) AverageAmbientTemp ¶
func (s *NodeStatus) AverageAmbientTemp() (float64, error)
func (*NodeStatus) AverageCPUTemp ¶
func (s *NodeStatus) AverageCPUTemp() (float64, error)
func (*NodeStatus) AverageCPUUsage ¶
func (s *NodeStatus) AverageCPUUsage() (float64, error)
type PowerConsumption ¶
type PowerConsumption = api.PowerConsumption
type RedfishNodeMonitor ¶
type RedfishNodeMonitor struct { }
func (*RedfishNodeMonitor) FetchStatus ¶
func (m *RedfishNodeMonitor) FetchStatus(ctx context.Context) (NodeStatus, error)
type Server ¶
type Server struct { Estimators *Estimators // contains filtered or unexported fields }
func (*Server) HandlerWithAuthFn ¶
func (*Server) PostNamespacesNsEstimatorsNameValuesPowerconsumption ¶
func (s *Server) PostNamespacesNsEstimatorsNameValuesPowerconsumption(ctx context.Context, request api.PostNamespacesNsEstimatorsNameValuesPowerconsumptionRequestObject) (api.PostNamespacesNsEstimatorsNameValuesPowerconsumptionResponseObject, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.