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
71649676
Commit
71649676
authored
Oct 26, 2018
by
zhangmingld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
combine similar code where calucate schedule priority
parent
0ba00ec3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
generic_scheduler.go
pkg/scheduler/core/generic_scheduler.go
+11
-16
No files found.
pkg/scheduler/core/generic_scheduler.go
View file @
71649676
...
@@ -653,28 +653,23 @@ func PrioritizeNodes(
...
@@ -653,28 +653,23 @@ func PrioritizeNodes(
results
:=
make
([]
schedulerapi
.
HostPriorityList
,
len
(
priorityConfigs
),
len
(
priorityConfigs
))
results
:=
make
([]
schedulerapi
.
HostPriorityList
,
len
(
priorityConfigs
),
len
(
priorityConfigs
))
for
i
,
priorityConfig
:=
range
priorityConfigs
{
for
i
:=
range
priorityConfigs
{
if
priorityConfig
.
Function
!=
nil
{
results
[
i
]
=
make
(
schedulerapi
.
HostPriorityList
,
len
(
nodes
))
// DEPRECATED
wg
.
Add
(
1
)
go
func
(
index
int
,
config
algorithm
.
PriorityConfig
)
{
defer
wg
.
Done
()
var
err
error
results
[
index
],
err
=
config
.
Function
(
pod
,
nodeNameToInfo
,
nodes
)
if
err
!=
nil
{
appendError
(
err
)
}
}(
i
,
priorityConfig
)
}
else
{
results
[
i
]
=
make
(
schedulerapi
.
HostPriorityList
,
len
(
nodes
))
}
}
}
processNode
:=
func
(
index
int
)
{
processNode
:=
func
(
index
int
)
{
nodeInfo
:=
nodeNameToInfo
[
nodes
[
index
]
.
Name
]
nodeInfo
:=
nodeNameToInfo
[
nodes
[
index
]
.
Name
]
var
err
error
var
err
error
for
i
:=
range
priorityConfigs
{
for
i
,
priorityConfig
:=
range
priorityConfigs
{
// DEPRECATED when ALL priorityConfigs have Map-Reduce pattern.
if
priorityConfigs
[
i
]
.
Function
!=
nil
{
if
priorityConfigs
[
i
]
.
Function
!=
nil
{
// Make sure that the old-style priority function only runs once.
if
results
[
i
][
0
]
.
Host
==
""
{
results
[
i
],
err
=
priorityConfig
.
Function
(
pod
,
nodeNameToInfo
,
nodes
)
if
err
!=
nil
{
appendError
(
err
)
}
}
continue
continue
}
}
results
[
i
][
index
],
err
=
priorityConfigs
[
i
]
.
Map
(
pod
,
meta
,
nodeInfo
)
results
[
i
][
index
],
err
=
priorityConfigs
[
i
]
.
Map
(
pod
,
meta
,
nodeInfo
)
...
...
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