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
8f87f580
Unverified
Commit
8f87f580
authored
Apr 04, 2019
by
Wei Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scheduler: tweak scheduler factory mutex
parent
96005559
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
plugins.go
pkg/scheduler/factory/plugins.go
+5
-6
No files found.
pkg/scheduler/factory/plugins.go
View file @
8f87f580
...
...
@@ -77,7 +77,7 @@ type PriorityConfigFactory struct {
}
var
(
schedulerFactoryMutex
sync
.
Mutex
schedulerFactoryMutex
sync
.
RW
Mutex
// maps that hold registered algorithm types
fitPredicateMap
=
make
(
map
[
string
]
FitPredicateFactory
)
...
...
@@ -139,7 +139,6 @@ func RemovePredicateKeyFromAlgorithmProviderMap(key string) {
for
_
,
provider
:=
range
algorithmProviderMap
{
provider
.
FitPredicateKeys
.
Delete
(
key
)
}
return
}
// InsertPredicateKeyToAlgoProvider insert a fit predicate key to algorithmProvider.
...
...
@@ -376,8 +375,8 @@ func buildScoringFunctionShapeFromRequestedToCapacityRatioArguments(arguments *s
// IsPriorityFunctionRegistered is useful for testing providers.
func
IsPriorityFunctionRegistered
(
name
string
)
bool
{
schedulerFactoryMutex
.
Lock
()
defer
schedulerFactoryMutex
.
Unlock
()
schedulerFactoryMutex
.
R
Lock
()
defer
schedulerFactoryMutex
.
R
Unlock
()
_
,
ok
:=
priorityFunctionMap
[
name
]
return
ok
}
...
...
@@ -397,8 +396,8 @@ func RegisterAlgorithmProvider(name string, predicateKeys, priorityKeys sets.Str
// GetAlgorithmProvider should not be used to modify providers. It is publicly visible for testing.
func
GetAlgorithmProvider
(
name
string
)
(
*
AlgorithmProviderConfig
,
error
)
{
schedulerFactoryMutex
.
Lock
()
defer
schedulerFactoryMutex
.
Unlock
()
schedulerFactoryMutex
.
R
Lock
()
defer
schedulerFactoryMutex
.
R
Unlock
()
provider
,
ok
:=
algorithmProviderMap
[
name
]
if
!
ok
{
...
...
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