Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
dbdc7824
Commit
dbdc7824
authored
Mar 25, 2019
by
Ted Yu
Committed by
Ted Yu
Mar 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify the loop for latest start time in pickOneNodeForPreemption
parent
1cb55029
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
15 deletions
+4
-15
generic_scheduler.go
pkg/scheduler/core/generic_scheduler.go
+4
-15
No files found.
pkg/scheduler/core/generic_scheduler.go
View file @
dbdc7824
...
@@ -916,8 +916,8 @@ func pickOneNodeForPreemption(nodesToVictims map[*v1.Node]*schedulerapi.Victims)
...
@@ -916,8 +916,8 @@ func pickOneNodeForPreemption(nodesToVictims map[*v1.Node]*schedulerapi.Victims)
klog
.
Errorf
(
"earliestStartTime is nil for node %s. Should not reach here."
,
minNodes2
[
0
])
klog
.
Errorf
(
"earliestStartTime is nil for node %s. Should not reach here."
,
minNodes2
[
0
])
return
minNodes2
[
0
]
return
minNodes2
[
0
]
}
}
lenNodes1
=
0
nodeToReturn
:=
minNodes2
[
0
]
for
i
:=
0
;
i
<
lenNodes2
;
i
++
{
for
i
:=
1
;
i
<
lenNodes2
;
i
++
{
node
:=
minNodes2
[
i
]
node
:=
minNodes2
[
i
]
// Get earliest start time of all pods on the current node.
// Get earliest start time of all pods on the current node.
earliestStartTimeOnNode
:=
util
.
GetEarliestPodStartTime
(
nodesToVictims
[
node
])
earliestStartTimeOnNode
:=
util
.
GetEarliestPodStartTime
(
nodesToVictims
[
node
])
...
@@ -927,22 +927,11 @@ func pickOneNodeForPreemption(nodesToVictims map[*v1.Node]*schedulerapi.Victims)
...
@@ -927,22 +927,11 @@ func pickOneNodeForPreemption(nodesToVictims map[*v1.Node]*schedulerapi.Victims)
}
}
if
earliestStartTimeOnNode
.
After
(
latestStartTime
.
Time
)
{
if
earliestStartTimeOnNode
.
After
(
latestStartTime
.
Time
)
{
latestStartTime
=
earliestStartTimeOnNode
latestStartTime
=
earliestStartTimeOnNode
lenNodes1
=
0
nodeToReturn
=
node
}
if
earliestStartTimeOnNode
.
Equal
(
latestStartTime
)
{
minNodes1
[
lenNodes1
]
=
node
lenNodes1
++
}
}
}
}
// At this point, even if there are more than one node with the same score,
return
nodeToReturn
// return the first one.
if
lenNodes1
>
0
{
return
minNodes1
[
0
]
}
klog
.
Errorf
(
"Error in logic of node scoring for preemption. We should never reach here!"
)
return
nil
}
}
// selectNodesForPreemption finds all the nodes with possible victims for
// selectNodesForPreemption finds all the nodes with possible victims for
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment