-
Notifications
You must be signed in to change notification settings - Fork 543
fix(scheduler): schedule tasks on new pods when BatchSandbox scales out #399
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: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,10 @@ type TaskScheduler interface { | |
| UpdatePods(pod []*corev1.Pod) | ||
| ListTask() []Task | ||
| StopTask() []Task | ||
| // AddTasks registers task specs that are not yet tracked by the scheduler. | ||
| // Tasks whose names are already tracked are silently skipped, making this | ||
| // safe to call with the full task list during a scale-out reconciliation. | ||
| AddTasks(tasks []*apis.Task) error | ||
|
Comment on lines
27
to
+33
|
||
| } | ||
|
|
||
| func NewTaskScheduler(name string, tasks []*apis.Task, pods []*corev1.Pod, resPolicyWhenTaskCompleted sandboxv1alpha1.TaskResourcePolicy, logger logr.Logger) (TaskScheduler, error) { | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
AddTaskscurrently callsinitTaskNodes(tasks)for the full task list every time, even though most tasks may already be tracked. In a reconciliation loop, this can become unnecessarily expensive as replica counts grow (allocating[]*taskNodeproportional to total replicas every call). Consider filtering to only the missing task specs first (by checkingtaskNodeByNameIndexon the incomingtasks), then initializing/appending nodes only for that smaller subset.