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
ddcdf6a7
Commit
ddcdf6a7
authored
Nov 04, 2015
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Offers() dependency from ErrorHandler by moving out BreakChan factory
parent
4d99ee7e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
20 deletions
+23
-20
scheduler.monopic
contrib/mesos/docs/scheduler.monopic
+0
-0
errorhandler.go
...sos/pkg/scheduler/components/errorhandler/errorhandler.go
+4
-19
scheduler.go
contrib/mesos/pkg/scheduler/components/scheduler.go
+19
-1
doc.go
contrib/mesos/pkg/scheduler/doc.go
+0
-0
No files found.
contrib/mesos/docs/scheduler.monopic
View file @
ddcdf6a7
No preview for this file type
contrib/mesos/pkg/scheduler/components/errorhandler/errorhandler.go
View file @
ddcdf6a7
...
...
@@ -18,7 +18,6 @@ package errorhandler
import
(
log
"github.com/golang/glog"
mesos
"github.com/mesos/mesos-go/mesosproto"
"k8s.io/kubernetes/contrib/mesos/pkg/backoff"
"k8s.io/kubernetes/contrib/mesos/pkg/queue"
"k8s.io/kubernetes/contrib/mesos/pkg/scheduler"
...
...
@@ -38,15 +37,15 @@ type errorHandler struct {
sched
scheduler
.
Scheduler
backoff
*
backoff
.
Backoff
qr
*
queuer
.
Queuer
podScheduler
podschedulers
.
PodScheduler
newBreakChan
func
(
podKey
string
)
queue
.
BreakChan
}
func
New
(
sched
scheduler
.
Scheduler
,
backoff
*
backoff
.
Backoff
,
qr
*
queuer
.
Queuer
,
podScheduler
podschedulers
.
PodScheduler
)
ErrorHandler
{
func
New
(
sched
scheduler
.
Scheduler
,
backoff
*
backoff
.
Backoff
,
qr
*
queuer
.
Queuer
,
newBC
func
(
podKey
string
)
queue
.
BreakChan
)
ErrorHandler
{
return
&
errorHandler
{
sched
:
sched
,
backoff
:
backoff
,
qr
:
qr
,
podScheduler
:
podScheduler
,
newBreakChan
:
newBC
,
}
}
...
...
@@ -87,21 +86,7 @@ func (k *errorHandler) Error(pod *api.Pod, schedulingErr error) {
breakoutEarly
:=
queue
.
BreakChan
(
nil
)
if
schedulingErr
==
podschedulers
.
NoSuitableOffersErr
{
log
.
V
(
3
)
.
Infof
(
"adding backoff breakout handler for pod %v"
,
podKey
)
breakoutEarly
=
queue
.
BreakChan
(
k
.
sched
.
Offers
()
.
Listen
(
podKey
,
func
(
offer
*
mesos
.
Offer
)
bool
{
k
.
sched
.
Lock
()
defer
k
.
sched
.
Unlock
()
switch
task
,
state
:=
k
.
sched
.
Tasks
()
.
Get
(
task
.
ID
);
state
{
case
podtask
.
StatePending
:
// Assess fitness of pod with the current offer. The scheduler normally
// "backs off" when it can't find an offer that matches up with a pod.
// The backoff period for a pod can terminate sooner if an offer becomes
// available that matches up.
return
!
task
.
Has
(
podtask
.
Launched
)
&&
k
.
podScheduler
.
FitPredicate
()(
task
,
offer
,
nil
)
default
:
// no point in continuing to check for matching offers
return
true
}
}))
breakoutEarly
=
k
.
newBreakChan
(
podKey
)
}
delay
:=
k
.
backoff
.
Get
(
podKey
)
log
.
V
(
3
)
.
Infof
(
"requeuing pod %v with delay %v"
,
podKey
,
delay
)
...
...
contrib/mesos/pkg/scheduler/components/scheduler.go
View file @
ddcdf6a7
...
...
@@ -20,6 +20,7 @@ import (
"net/http"
"sync"
mesos
"github.com/mesos/mesos-go/mesosproto"
"k8s.io/kubernetes/contrib/mesos/pkg/backoff"
"k8s.io/kubernetes/contrib/mesos/pkg/offers"
"k8s.io/kubernetes/contrib/mesos/pkg/queue"
...
...
@@ -75,7 +76,24 @@ func New(c *config.Config, fw framework.Framework, ps podschedulers.PodScheduler
core
.
podReconciler
=
podreconciler
.
New
(
core
,
client
,
q
,
podDeleter
)
bo
:=
backoff
.
New
(
c
.
InitialPodBackoff
.
Duration
,
c
.
MaxPodBackoff
.
Duration
)
errorHandler
:=
errorhandler
.
New
(
core
,
bo
,
q
,
ps
)
newBC
:=
func
(
podKey
string
)
queue
.
BreakChan
{
return
queue
.
BreakChan
(
core
.
Offers
()
.
Listen
(
podKey
,
func
(
offer
*
mesos
.
Offer
)
bool
{
core
.
Lock
()
defer
core
.
Unlock
()
switch
task
,
state
:=
core
.
Tasks
()
.
ForPod
(
podKey
);
state
{
case
podtask
.
StatePending
:
// Assess fitness of pod with the current offer. The scheduler normally
// "backs off" when it can't find an offer that matches up with a pod.
// The backoff period for a pod can terminate sooner if an offer becomes
// available that matches up.
return
!
task
.
Has
(
podtask
.
Launched
)
&&
ps
.
FitPredicate
()(
task
,
offer
,
nil
)
default
:
// no point in continuing to check for matching offers
return
true
}
}))
}
errorHandler
:=
errorhandler
.
New
(
core
,
bo
,
q
,
newBC
)
binder
:=
binder
.
New
(
core
)
...
...
contrib/mesos/pkg/scheduler/doc.go
View file @
ddcdf6a7
This diff is collapsed.
Click to expand it.
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