Skip to content

Commit

Permalink
Scheduler: remove unused fields on schedulerobjects.Node (#3787)
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Smith <[email protected]>
  • Loading branch information
robertdavidsmith committed Jul 14, 2024
1 parent e9c6e78 commit 49c7c91
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 678 deletions.
20 changes: 3 additions & 17 deletions internal/scheduler/nodedb/nodedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ func (nodeDb *NodeDb) create(node *schedulerobjects.Node) (*internaltypes.Node,
}
allocatableByPriority[evictedPriority] = allocatableByPriority[minimumPriority]

evictedJobRunIds := node.EvictedJobRunIds
if evictedJobRunIds == nil {
evictedJobRunIds = make(map[string]bool)
}

nodeDb.mu.Lock()
for key := range nodeDb.indexedNodeLabels {
if value, ok := labels[key]; ok {
Expand All @@ -96,9 +91,9 @@ func (nodeDb *NodeDb) create(node *schedulerobjects.Node) (*internaltypes.Node,
labels,
nodeDb.resourceListFactory.FromNodeProto(totalResources.Resources),
allocatableByPriority,
fromMapKToJobResourcesIgnoreUnknown(nodeDb.resourceListFactory, node.AllocatedByQueue),
fromMapKToJobResourcesIgnoreUnknown(nodeDb.resourceListFactory, node.AllocatedByJobId),
evictedJobRunIds,
map[string]internaltypes.ResourceList{},
map[string]internaltypes.ResourceList{},
map[string]bool{},
nil), nil
}

Expand All @@ -110,15 +105,6 @@ func (nodeDb *NodeDb) copyMapWithIntern(labels map[string]string) map[string]str
return result
}

// Ignore unknown resources, round up.
func fromMapKToJobResourcesIgnoreUnknown[K comparable](factory *internaltypes.ResourceListFactory, m map[K]schedulerobjects.ResourceList) map[K]internaltypes.ResourceList {
result := make(map[K]internaltypes.ResourceList, len(m))
for k, v := range m {
result[k] = factory.FromJobResourceListIgnoreUnknown(v.Resources)
}
return result
}

func (nodeDb *NodeDb) CreateAndInsertWithJobDbJobsWithTxn(txn *memdb.Txn, jobs []*jobdb.Job, node *schedulerobjects.Node) error {
entry, err := nodeDb.create(node)
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions internal/scheduler/schedulerobjects/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ func (node *Node) DeepCopy() *Node {
node.AllocatableByPriorityAndResource,
).DeepCopy(),
StateByJobRunId: maps.Clone(node.StateByJobRunId),
AllocatedByJobId: armadamaps.DeepCopy(node.AllocatedByJobId),
AllocatedByQueue: armadamaps.DeepCopy(node.AllocatedByQueue),
EvictedJobRunIds: maps.Clone(node.EvictedJobRunIds),
NonArmadaAllocatedResources: armadamaps.DeepCopy(node.NonArmadaAllocatedResources),
Unschedulable: node.Unschedulable,
}
Expand Down
Loading

0 comments on commit 49c7c91

Please sign in to comment.