Skip to content
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

Scheduler: confirm can locally calculate fields of Node in nodedb #3776

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions internal/scheduler/nodedb/nodedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,46 @@
var empty struct{}

func (nodeDb *NodeDb) create(node *schedulerobjects.Node) (*internaltypes.Node, error) {

Check failure on line 40 in internal/scheduler/nodedb/nodedb.go

View workflow job for this annotation

GitHub Actions / lint / Lint Go

File is not `gofumpt`-ed (gofumpt)
if len(node.AllocatedByJobId) > 0 {
panic("AllocatedByJobId")
}
if len(node.AllocatedByQueue) > 0 {
panic("AllocatedByQueue")
}
if len(node.EvictedJobRunIds) > 0 {
panic("EvictedJobRunIds")
}

robAllocatable := schedulerobjects.NewAllocatableByPriorityAndResourceType(
types.AllowedPriorities(nodeDb.priorityClasses),
node.TotalResources,
)
for p, rl := range node.NonArmadaAllocatedResources {
robAllocatable.MarkAllocated(p, rl)
}

if len(robAllocatable) != len(node.AllocatableByPriorityAndResource) {
fmt.Printf("existing %v, rob %v", node.AllocatableByPriorityAndResource, robAllocatable)
panic("AllocatableByPriorityAndResource lengths")
}

for p, a := range node.AllocatableByPriorityAndResource {
robA, exists := robAllocatable[p]
if !exists {
fmt.Printf("existing %v, rob %v", node.AllocatableByPriorityAndResource, robAllocatable)
panic("AllocatableByPriorityAndResource missing")
}
cpy := a.DeepCopy()
cpy.Sub(robA)
if !cpy.IsZero() {
fmt.Printf("existing %v, rob %v", node.AllocatableByPriorityAndResource, robAllocatable)
panic("AllocatableByPriorityAndResource ne")
}
}

fmt.Printf("All is good for %s\n", node.Name)

taints := node.GetTaints()
if node.Unschedulable {
taints = append(koTaint.DeepCopyTaintsInternStrings(taints, nodeDb.stringInterner.Intern), UnschedulableTaint())
Expand Down
Loading