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
b8fece50
Unverified
Commit
b8fece50
authored
Nov 09, 2018
by
k8s-ci-robot
Committed by
GitHub
Nov 09, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #70892 from mikedanese/schedrace
Fix a race in the scheduler.
parents
be71fbe5
62c3ec96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
16 deletions
+21
-16
generic_scheduler.go
pkg/scheduler/core/generic_scheduler.go
+21
-16
No files found.
pkg/scheduler/core/generic_scheduler.go
View file @
b8fece50
...
@@ -653,33 +653,38 @@ func PrioritizeNodes(
...
@@ -653,33 +653,38 @@ func PrioritizeNodes(
results
:=
make
([]
schedulerapi
.
HostPriorityList
,
len
(
priorityConfigs
),
len
(
priorityConfigs
))
results
:=
make
([]
schedulerapi
.
HostPriorityList
,
len
(
priorityConfigs
),
len
(
priorityConfigs
))
for
i
:=
range
priorityConfigs
{
// DEPRECATED: we can remove this when all priorityConfigs implement the
results
[
i
]
=
make
(
schedulerapi
.
HostPriorityList
,
len
(
nodes
))
// Map-Reduce pattern.
}
workqueue
.
ParallelizeUntil
(
context
.
TODO
(),
16
,
len
(
priorityConfigs
),
func
(
i
int
)
{
priorityConfig
:=
priorityConfigs
[
i
]
if
priorityConfig
.
Function
==
nil
{
results
[
i
]
=
make
(
schedulerapi
.
HostPriorityList
,
len
(
nodes
))
return
}
processNode
:=
func
(
index
int
)
{
nodeInfo
:=
nodeNameToInfo
[
nodes
[
index
]
.
Name
]
var
err
error
var
err
error
results
[
i
],
err
=
priorityConfig
.
Function
(
pod
,
nodeNameToInfo
,
nodes
)
if
err
!=
nil
{
appendError
(
err
)
}
})
workqueue
.
ParallelizeUntil
(
context
.
TODO
(),
16
,
len
(
nodes
),
func
(
index
int
)
{
nodeInfo
:=
nodeNameToInfo
[
nodes
[
index
]
.
Name
]
for
i
,
priorityConfig
:=
range
priorityConfigs
{
for
i
,
priorityConfig
:=
range
priorityConfigs
{
// DEPRECATED when ALL priorityConfigs have Map-Reduce pattern.
if
priorityConfig
.
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
}
}
var
err
error
results
[
i
][
index
],
err
=
priorityConfigs
[
i
]
.
Map
(
pod
,
meta
,
nodeInfo
)
results
[
i
][
index
],
err
=
priorityConfigs
[
i
]
.
Map
(
pod
,
meta
,
nodeInfo
)
if
err
!=
nil
{
if
err
!=
nil
{
appendError
(
err
)
appendError
(
err
)
results
[
i
][
index
]
.
Host
=
nodes
[
index
]
.
Name
results
[
i
][
index
]
.
Host
=
nodes
[
index
]
.
Name
}
}
}
}
}
}
)
workqueue
.
ParallelizeUntil
(
context
.
TODO
(),
16
,
len
(
nodes
),
processNode
)
for
i
,
priorityConfig
:=
range
priorityConfigs
{
for
i
,
priorityConfig
:=
range
priorityConfigs
{
if
priorityConfig
.
Reduce
==
nil
{
if
priorityConfig
.
Reduce
==
nil
{
continue
continue
...
...
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