scheduler

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName = "agent_scheduler"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ALGORITHM

type ALGORITHM string
const (
	ALGORITHM_ROUND_ROBIN  ALGORITHM = "round_robin"  // 轮询调度
	ALGORITHM_CPU_FIRST    ALGORITHM = "cpu_first"    // CPU 型任务优先
	ALGORITHM_MEMORY_FIRST ALGORITHM = "memory_first" // 内存型任务优先
	ALGORITHM_BEST_FIT     ALGORITHM = "best_fit"     // 最优匹配
)

type SelectBestAgentRequest

type SelectBestAgentRequest struct {
	// Agent ID 列表
	AgentIds []string `json:"agent_ids" form:"agent_ids" query:"agent_ids"`
	// 调度算法
	ScheduleAlgorithm ALGORITHM `json:"schedule_algorithm" form:"schedule_algorithm" query:"schedule_algorithm"`
	// 统计时间范围,单位分钟
	DurationMinutes int64 `json:"duration_minutes" form:"duration_minutes" query:"duration_minutes"`
}

func NewSelectBestAgentRequest

func NewSelectBestAgentRequest() *SelectBestAgentRequest

func (*SelectBestAgentRequest) AddAgentId

func (r *SelectBestAgentRequest) AddAgentId(ids ...string) *SelectBestAgentRequest

type Service

type Service interface {
	// SelectBestAgent 根据 Metric 列表,选取一个最优的 Agent ID 进行任务调度
	// 参考 Kubernetes 调度策略,采用两阶段调度:
	// 1. 过滤阶段:筛选出资源充足的 Agent
	// 2. 打分阶段:对通过过滤的 Agent 进行打分,选择最优 Agent
	SelectBestAgent(ctx context.Context, metrics *SelectBestAgentRequest) (string, error)
}

Service Agent 调度器接口 根据 Agent 指标选择最优 Agent 进行任务调度

func GetService

func GetService() Service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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