topnode

package
v0.12.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GPUCoreShareNodeDescription = `` /* 238-byte string literal not displayed */
View Source
var GPUExclusiveNodeDescription = `` /* 135-byte string literal not displayed */
View Source
var GPUShareNodeDescription = `` /* 136-byte string literal not displayed */
View Source
var GPUTopologyNodeDescription = `` /* 133-byte string literal not displayed */
View Source
var NormalNodeDescription = `
  This node has none gpu devices
`

Functions

func DisplayNodeDetails

func DisplayNodeDetails(nodeNames []string, nodeType types.NodeType, format types.FormatStyle, showMetric bool) error

func DisplayNodeSummary

func DisplayNodeSummary(nodeNames []string, targetNodeType types.NodeType, format types.FormatStyle, showMetric bool) error

format like:

NAME IPADDRESS ROLE STATUS GPU(Total) GPU(Allocated) GPU_MODE cn-shanghai.192.168.7.178 192.168.7.178 master Ready 0 0 none cn-shanghai.192.168.7.179 192.168.7.179 master Ready 0 0 none cn-shanghai.192.168.7.180 192.168.7.180 master Ready 0 0 none cn-shanghai.192.168.7.181 192.168.7.181 <none> Ready 0 0 none cn-shanghai.192.168.7.182 192.168.7.182 <none> Ready 1 0 exclusive cn-shanghai.192.168.7.186 192.168.7.186 <none> Ready 4 0 topology cn-shanghai.192.168.7.183 192.168.7.183 <none> Ready 4 2.1 share

func GetNodeGpuMetrics

func GetNodeGpuMetrics(client *kubernetes.Clientset) (map[string]types.NodeGpuMetric, error)

func IsGPUExclusiveNode

func IsGPUExclusiveNode(node *v1.Node) bool

func IsGPUShareNode

func IsGPUShareNode(node *v1.Node) bool

func IsGPUTopologyNode

func IsGPUTopologyNode(node *v1.Node) bool

func ListNodeDetails

func ListNodeDetails(nodeNames []string, nodeType types.NodeType, showMetric bool) (types.AllNodeInfo, error)

func PrintLine

func PrintLine(w io.Writer, fields ...string)

Types

type Node

type Node interface {
	// Index is used to sort the nodes
	Index() int
	// Name return the node name
	Name() string
	// Type return the node type
	Type() types.NodeType
	// Role returns the role of node
	Role() []string
	// IP returns the node ip
	IP() string
	// Status returns the node status
	Status() string
	// GetV1Pods returns the pods of node
	GetV1Pods() []*v1.Pod
	// GetV1Node returns the v1.node
	GetV1Node() *v1.Node
	// Convert2NodeInfo convert node to node info
	Convert2NodeInfo() interface{}
	// AllDevicesAreHealthy returns the all devices are healthy
	AllDevicesAreHealthy() bool
	// WideFormat is used to display node information with wide format
	WideFormat() string
}

func BuildNodes

func BuildNodes(nodeNames []string, targetNodeType types.NodeType, showMetric bool) ([]Node, error)

func NewGPUExclusiveNode

func NewGPUExclusiveNode(client *kubernetes.Clientset, node *v1.Node, index int, args buildNodeArgs) (Node, error)

func NewGPUShareNode

func NewGPUShareNode(client *kubernetes.Clientset, node *v1.Node, index int, args buildNodeArgs) (Node, error)

func NewGPUTopologyNode

func NewGPUTopologyNode(client *kubernetes.Clientset, node *v1.Node, index int, args buildNodeArgs) (Node, error)

func NewNormalNode

func NewNormalNode(client *kubernetes.Clientset, node *v1.Node, index int, args buildNodeArgs) (Node, error)

type NodeProcesser

type NodeProcesser interface {
	// BuildNode builds the nodes and return the skip nodes
	BuildNode(client *kubernetes.Clientset, v1nodes *v1.Node, nodes []Node, targetNodeType types.NodeType, index int, args buildNodeArgs) ([]Node, bool)
	// Convert2NodeInfos filters nodes
	Convert2NodeInfos(nodes []Node, allNodes types.AllNodeInfo) types.AllNodeInfo
	// DisplayNodesDetails display nodes which the processer knowns
	DisplayNodesDetails(w *tabwriter.Writer, nodes []Node)
	// DisplayNodesSummary display nodes summary
	DisplayNodesSummary(w *tabwriter.Writer, nodes []Node, showNodeType, isUnhealthy bool) (float64, float64, float64)
	// DisplayNodesCustomSummary display custom format of target type nodes
	DisplayNodesCustomSummary(w *tabwriter.Writer, nodes []Node)
	// SupportedNodeType Type returns the supported node type
	SupportedNodeType() types.NodeType
}

NodeProcesser process the node

func GetSupportedNodePorcessers

func GetSupportedNodePorcessers() []NodeProcesser

NewNormalNodeProcesser must be placed at last,it will match all unknown nodes

func NewGPUExclusiveNodeProcesser

func NewGPUExclusiveNodeProcesser() NodeProcesser

func NewGPUShareNodeProcesser

func NewGPUShareNodeProcesser() NodeProcesser

func NewGPUTopologyNodeProcesser

func NewGPUTopologyNodeProcesser() NodeProcesser

func NewNormalNodeProcesser

func NewNormalNodeProcesser() NodeProcesser

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL