-
Notifications
You must be signed in to change notification settings - Fork 44
feat(Scheduler): Support priority/elder/depends based scheduling. #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a comprehensive scheduler system with priority, dependency, and cron-based scheduling capabilities. The new scheduler replaces the previous simple queue-based system with a sophisticated task management framework supporting advanced scheduling algorithms.
Key changes:
- New scheduler architecture with modular components for algorithm, resource, task, and cron management
- Priority-based scheduling with support for task dependencies (preorders)
- Cron expression support for recurring tasks
- Worker group management and resource allocation improvements
Reviewed Changes
Copilot reviewed 40 out of 41 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
vermeer/test/scheduler/*.go | Test framework for scheduler functionality including priority, dependency, and cron testing |
vermeer/apps/master/schedules/*.go | Core scheduler implementation with algorithm, resource, task, and cron managers |
vermeer/client/*.go | Client API extensions for batch operations and task sequence tracking |
vermeer/apps/structure/task.go | Task structure enhancements for scheduler fields |
vermeer/apps/master/bl/*.go | Business logic updates to integrate with new scheduler |
vermeer/config/*.ini | Configuration additions for scheduler parameters |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
if num <= 10 { | ||
num = 30 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic numbers 10 and 30 should be defined as named constants to improve code maintainability and explain why these specific values are chosen.
Copilot uses AI. Check for mistakes.
if graph == nil { | ||
resourceCost = resourceParam // if graph not found, use max resource cost | ||
} else { | ||
resourceCost = resourceParam / max(1, graph.VertexCount+graph.EdgeCount) // Avoid division by zero, ensure at least 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calculation logic for resourceCost is complex and should be extracted into a separate method with proper documentation explaining the algorithm.
Copilot uses AI. Check for mistakes.
for _, preorder := range preorderList { | ||
if pid, err := strconv.ParseInt(preorder, 10, 32); err == nil { | ||
if taskMgr.GetTaskByID(int32(pid)) == nil { | ||
return nil, fmt.Errorf("preorder task id %d not exists", pid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message 'preorder task id %d not exists' has incorrect grammar. It should be 'preorder task with ID %d does not exist'.
return nil, fmt.Errorf("preorder task id %d not exists", pid) | |
return nil, fmt.Errorf("preorder task with ID %d does not exist", pid) |
Copilot uses AI. Check for mistakes.
return tasks | ||
} | ||
|
||
func (t *SchedulerTaskManager) GetAllTasksWaitng() []*structure.TaskInfo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function name has a typo: 'GetAllTasksWaitng' should be 'GetAllTasksWaiting'.
func (t *SchedulerTaskManager) GetAllTasksWaitng() []*structure.TaskInfo { | |
func (t *SchedulerTaskManager) GetAllTasksWaiting() []*structure.TaskInfo { |
Copilot uses AI. Check for mistakes.
func (s *ScheduleBl) waitingStartedTask() { | ||
for taskInfo := range s.startChan { | ||
if taskInfo == nil { | ||
logrus.Warnf("recieved a nil task from startChan") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: 'recieved' should be 'received'.
logrus.Warnf("recieved a nil task from startChan") | |
logrus.Warnf("received a nil task from startChan") |
Copilot uses AI. Check for mistakes.
e93187d
to
d2efa3e
Compare
Purpose of the PR
Main Changes
Verifying these changes
I have write some scripts in /test folder.
Does this PR potentially affect the following parts?
Documentation Status
Doc - TODO
Doc - Done
Doc - No Need