filter

package
v1.47.5 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterDetail added in v1.41.0

type FilterDetail struct {
	FilterName string
	Before     []string
	After      []string
	Diff       int
}

type FilterRegistry

type FilterRegistry struct {
	// contains filtered or unexported fields
}

FilterRegistry provides an immutable collection of GPU filters with methods to create new instances with additional filters

func NewFilterRegistry

func NewFilterRegistry() *FilterRegistry

NewFilterRegistry creates a new empty filter registry

func (*FilterRegistry) Apply

func (fr *FilterRegistry) Apply(
	ctx context.Context,
	workerPodKey tfv1.NameNamespace,
	gpus []*tfv1.GPU,
	isSimulateSchedule bool,
) ([]*tfv1.GPU, []FilterDetail, error)

Apply applies the filters in this registry to the given GPU list Filters are applied in the order they were added (parent filters first)

func (*FilterRegistry) With

func (fr *FilterRegistry) With(filters ...GPUFilter) *FilterRegistry

With creates a new FilterRegistry with the provided filters added The original FilterRegistry is not modified

type GPUFilter

type GPUFilter interface {
	// Filter filters the list of GPUs and returns only those that pass the filter criteria
	// The implementation should not modify the input slice
	Filter(ctx context.Context, workerPodKey tfv1.NameNamespace, gpus []*tfv1.GPU) ([]*tfv1.GPU, error)

	Name() string
}

GPUFilter defines an interface for filtering GPU candidates

type GPUModelFilter added in v1.30.0

type GPUModelFilter struct {
	// contains filtered or unexported fields
}

GPUModelFilter filters GPUs based on their model (e.g., A100, H100)

func NewGPUModelFilter added in v1.30.0

func NewGPUModelFilter(model string) *GPUModelFilter

NewGPUModelFilter creates a new filter that matches GPUs with the specified model

func (*GPUModelFilter) Filter added in v1.30.0

func (f *GPUModelFilter) Filter(ctx context.Context, workerPodKey tfv1.NameNamespace, gpus []*tfv1.GPU) ([]*tfv1.GPU, error)

Filter implements GPUFilter interface

func (*GPUModelFilter) Name added in v1.41.0

func (f *GPUModelFilter) Name() string

type NodeAffinityFilter added in v1.34.6

type NodeAffinityFilter struct {
	// contains filtered or unexported fields
}

func NewNodeAffinityFilter added in v1.34.6

func NewNodeAffinityFilter(c client.Reader, nodeAffinity *corev1.NodeAffinity) *NodeAffinityFilter

func (*NodeAffinityFilter) Filter added in v1.34.6

func (f *NodeAffinityFilter) Filter(ctx context.Context, workerPodKey tfv1.NameNamespace, gpus []*tfv1.GPU) ([]*tfv1.GPU, error)

Filter

func (*NodeAffinityFilter) Name added in v1.41.0

func (f *NodeAffinityFilter) Name() string

type PhaseFilter

type PhaseFilter struct {
	// contains filtered or unexported fields
}

PhaseFilter filters GPUs based on their operational phase

func NewPhaseFilter

func NewPhaseFilter(allowedPhases ...tfv1.TensorFusionGPUPhase) *PhaseFilter

NewPhaseFilter creates a new PhaseFilter with the specified allowed phases

func (*PhaseFilter) Filter

func (f *PhaseFilter) Filter(ctx context.Context, workerPodKey tfv1.NameNamespace, gpus []*tfv1.GPU) ([]*tfv1.GPU, error)

Filter implements GPUFilter.Filter

func (*PhaseFilter) Name added in v1.41.0

func (f *PhaseFilter) Name() string

type ResourceFilter

type ResourceFilter struct {
	// contains filtered or unexported fields
}

ResourceFilter filters GPUs based on available resources

func NewResourceFilter

func NewResourceFilter(required tfv1.Resource) *ResourceFilter

NewResourceFilter creates a new ResourceFilter with the specified resource requirements

func (*ResourceFilter) Filter

func (f *ResourceFilter) Filter(ctx context.Context, workerPodKey tfv1.NameNamespace, gpus []*tfv1.GPU) ([]*tfv1.GPU, error)

Filter implements GPUFilter.Filter

func (*ResourceFilter) Name added in v1.41.0

func (f *ResourceFilter) Name() string

type SameNodeFilter

type SameNodeFilter struct {
	// contains filtered or unexported fields
}

SameNodeFilter ensures that the selected GPUs are from the same node

func NewSameNodeFilter

func NewSameNodeFilter(count uint) *SameNodeFilter

NewSameNodeFilter creates a new SameNodeFilter with the specified count

func (*SameNodeFilter) Filter

func (f *SameNodeFilter) Filter(ctx context.Context, workerPodKey tfv1.NameNamespace, gpus []*tfv1.GPU) ([]*tfv1.GPU, error)

Filter implements GPUFilter.Filter It groups GPUs by node and returns only those nodes that have at least 'count' GPUs Must run at last step, otherwise some nodes and gpus passed may not valid at following steps

func (*SameNodeFilter) Name added in v1.41.0

func (f *SameNodeFilter) Name() string

Jump to

Keyboard shortcuts

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