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
267cc9de
Commit
267cc9de
authored
Sep 18, 2015
by
Mike Danese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
serialize access to active with a lock
parent
e07eb387
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
controller.go
pkg/controller/job/controller.go
+5
-0
No files found.
pkg/controller/job/controller.go
View file @
267cc9de
...
@@ -361,6 +361,7 @@ func getStatus(pods []api.Pod) (successful, unsuccessful int) {
...
@@ -361,6 +361,7 @@ func getStatus(pods []api.Pod) (successful, unsuccessful int) {
}
}
func
(
jm
*
JobController
)
manageJob
(
activePods
[]
*
api
.
Pod
,
successful
,
unsuccessful
int
,
job
*
experimental
.
Job
)
int
{
func
(
jm
*
JobController
)
manageJob
(
activePods
[]
*
api
.
Pod
,
successful
,
unsuccessful
int
,
job
*
experimental
.
Job
)
int
{
var
activeLock
sync
.
Mutex
active
:=
len
(
activePods
)
active
:=
len
(
activePods
)
parallelism
:=
*
job
.
Spec
.
Parallelism
parallelism
:=
*
job
.
Spec
.
Parallelism
jobKey
,
err
:=
controller
.
KeyFunc
(
job
)
jobKey
,
err
:=
controller
.
KeyFunc
(
job
)
...
@@ -389,7 +390,9 @@ func (jm *JobController) manageJob(activePods []*api.Pod, successful, unsuccessf
...
@@ -389,7 +390,9 @@ func (jm *JobController) manageJob(activePods []*api.Pod, successful, unsuccessf
glog
.
V
(
2
)
.
Infof
(
"Failed deletion, decrementing expectations for controller %q"
,
jobKey
)
glog
.
V
(
2
)
.
Infof
(
"Failed deletion, decrementing expectations for controller %q"
,
jobKey
)
jm
.
expectations
.
DeletionObserved
(
jobKey
)
jm
.
expectations
.
DeletionObserved
(
jobKey
)
util
.
HandleError
(
err
)
util
.
HandleError
(
err
)
activeLock
.
Lock
()
active
++
active
++
activeLock
.
Unlock
()
}
}
}(
i
)
}(
i
)
}
}
...
@@ -417,7 +420,9 @@ func (jm *JobController) manageJob(activePods []*api.Pod, successful, unsuccessf
...
@@ -417,7 +420,9 @@ func (jm *JobController) manageJob(activePods []*api.Pod, successful, unsuccessf
glog
.
V
(
2
)
.
Infof
(
"Failed creation, decrementing expectations for controller %q"
,
jobKey
)
glog
.
V
(
2
)
.
Infof
(
"Failed creation, decrementing expectations for controller %q"
,
jobKey
)
jm
.
expectations
.
CreationObserved
(
jobKey
)
jm
.
expectations
.
CreationObserved
(
jobKey
)
util
.
HandleError
(
err
)
util
.
HandleError
(
err
)
activeLock
.
Lock
()
active
--
active
--
activeLock
.
Unlock
()
}
}
}()
}()
}
}
...
...
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