Skip to content

Commit

Permalink
Update e2e test.
Browse files Browse the repository at this point in the history
Signed-off-by: jiangkaihua <jiangkaihua1@huawei.com>
  • Loading branch information
jiangkaihua committed Feb 7, 2021
1 parent d9855ac commit e721964
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 59 deletions.
54 changes: 27 additions & 27 deletions example/custom-plugin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@ module custom-plugin
go 1.14

replace (
github.com/volcano-sh/volcano => volcano.sh/volcano v1.1.0
k8s.io/api => k8s.io/api v0.18.3
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.3
k8s.io/apimachinery => k8s.io/apimachinery v0.18.3
k8s.io/apiserver => k8s.io/apiserver v0.18.3
k8s.io/cli-runtime => k8s.io/cli-runtime v0.18.3
k8s.io/client-go => k8s.io/client-go v0.18.3
k8s.io/cloud-provider => k8s.io/cloud-provider v0.18.3
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.18.3
k8s.io/code-generator => k8s.io/code-generator v0.18.3
k8s.io/component-base => k8s.io/component-base v0.18.3
k8s.io/cri-api => k8s.io/cri-api v0.18.3
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.18.3
k8s.io/klog => k8s.io/klog v1.0.0
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.18.3
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.18.3
k8s.io/kube-proxy => k8s.io/kube-proxy v0.18.3
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.18.3
k8s.io/kubectl => k8s.io/kubectl v0.18.3
k8s.io/kubelet => k8s.io/kubelet v0.18.3
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.18.3
k8s.io/metrics => k8s.io/metrics v0.18.3
k8s.io/node-api => k8s.io/node-api v0.18.3
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.18.3
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.18.3
k8s.io/sample-controller => k8s.io/sample-controller v0.18.3
github.com/volcano-sh/volcano => volcano.sh/volcano v1.1.0
k8s.io/api => k8s.io/api v0.18.3
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.3
k8s.io/apimachinery => k8s.io/apimachinery v0.18.3
k8s.io/apiserver => k8s.io/apiserver v0.18.3
k8s.io/cli-runtime => k8s.io/cli-runtime v0.18.3
k8s.io/client-go => k8s.io/client-go v0.18.3
k8s.io/cloud-provider => k8s.io/cloud-provider v0.18.3
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.18.3
k8s.io/code-generator => k8s.io/code-generator v0.18.3
k8s.io/component-base => k8s.io/component-base v0.18.3
k8s.io/cri-api => k8s.io/cri-api v0.18.3
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.18.3
k8s.io/klog => k8s.io/klog v1.0.0
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.18.3
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.18.3
k8s.io/kube-proxy => k8s.io/kube-proxy v0.18.3
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.18.3
k8s.io/kubectl => k8s.io/kubectl v0.18.3
k8s.io/kubelet => k8s.io/kubelet v0.18.3
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.18.3
k8s.io/metrics => k8s.io/metrics v0.18.3
k8s.io/node-api => k8s.io/node-api v0.18.3
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.18.3
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.18.3
k8s.io/sample-controller => k8s.io/sample-controller v0.18.3
)

require volcano.sh/volcano v1.1.0
require volcano.sh/volcano v1.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ tiers:
- name: gang
- name: conformance
- plugins:
- name: overcommit
- name: drf
- name: predicates
- name: proportion
Expand Down
3 changes: 1 addition & 2 deletions pkg/scheduler/actions/enqueue/enqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (enqueue *Action) Execute(ssn *framework.Session) {
}
job := jobs.Pop().(*api.JobInfo)

if job.PodGroup.Spec.MinResources == nil || ssn.JobEnqueueReject(job){
if job.PodGroup.Spec.MinResources == nil || ssn.JobEnqueueReject(job) {
job.PodGroup.Status.Phase = scheduling.PodGroupInqueue
ssn.Jobs[job.UID] = job
}
Expand All @@ -102,4 +102,3 @@ func (enqueue *Action) Execute(ssn *framework.Session) {
}

func (enqueue *Action) UnInitialize() {}

3 changes: 0 additions & 3 deletions pkg/scheduler/actions/enqueue/enqueue_test.go

This file was deleted.

28 changes: 14 additions & 14 deletions pkg/scheduler/framework/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ type Session struct {

// podGroupStatus cache podgroup status during schedule
// This should not be mutated after initiated
podGroupStatus map[api.JobID]scheduling.PodGroupStatus
podGroupStatus map[api.JobID]scheduling.PodGroupStatus

Jobs map[api.JobID]*api.JobInfo
Nodes map[string]*api.NodeInfo
Queues map[api.QueueID]*api.QueueInfo
NamespaceInfo map[api.NamespaceName]*api.NamespaceInfo
Jobs map[api.JobID]*api.JobInfo
Nodes map[string]*api.NodeInfo
Queues map[api.QueueID]*api.QueueInfo
NamespaceInfo map[api.NamespaceName]*api.NamespaceInfo

Tiers []conf.Tier
Configurations []conf.Configuration
Tiers []conf.Tier
Configurations []conf.Configuration

plugins map[string]Plugin
eventHandlers []*EventHandler
Expand Down Expand Up @@ -79,15 +79,15 @@ type Session struct {

func openSession(cache cache.Cache) *Session {
ssn := &Session{
UID: uuid.NewUUID(),
kubeClient: cache.Client(),
cache: cache,
UID: uuid.NewUUID(),
kubeClient: cache.Client(),
cache: cache,

podGroupStatus: map[api.JobID]scheduling.PodGroupStatus{},
podGroupStatus: map[api.JobID]scheduling.PodGroupStatus{},

Jobs: map[api.JobID]*api.JobInfo{},
Nodes: map[string]*api.NodeInfo{},
Queues: map[api.QueueID]*api.QueueInfo{},
Jobs: map[api.JobID]*api.JobInfo{},
Nodes: map[string]*api.NodeInfo{},
Queues: map[api.QueueID]*api.QueueInfo{},

plugins: map[string]Plugin{},
jobOrderFns: map[string]api.CompareFn{},
Expand Down
4 changes: 3 additions & 1 deletion pkg/scheduler/plugins/overcommit/overcommit.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type overcommitPlugin struct {
overCommitFactor float64
}

// New function returns overcommit plugin object
func New(arguments framework.Arguments) framework.Plugin {
return &overcommitPlugin{
pluginArguments: arguments,
Expand Down Expand Up @@ -88,6 +89,7 @@ func (op *overcommitPlugin) OnSessionOpen(ssn *framework.Session) {
klog.V(4).Infof("job <%s/%s> is bestEffort, allow it be inqueue", job.Namespace, job.Name)
return true
}
//TODO: allow 1 more job be inqueue beyond overcommit-factor, may cause large job inqueue and creating pods
if inqueue.LessEqual(idle) {
klog.V(4).Infof("sufficient resources, allow job <%s/%s> be inqueue", job.Namespace, job.Name)
op.inqueueResource.Add(api.NewResource(*job.PodGroup.Spec.MinResources))
Expand All @@ -102,4 +104,4 @@ func (op *overcommitPlugin) OnSessionOpen(ssn *framework.Session) {
func (op *overcommitPlugin) OnSessionClose(ssn *framework.Session) {
op.idleResource = nil
op.inqueueResource = nil
}
}
20 changes: 8 additions & 12 deletions pkg/scheduler/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ import (
func TestLoadSchedulerConf(t *testing.T) {
configuration := `
actions: "enqueue, allocate, backfill"
configurations:
- name: enqueue
arguments:
"overcommit-factor": 1.5
tiers:
- plugins:
- name: priority
Expand All @@ -53,6 +49,7 @@ tiers:
EnabledNamespaceOrder: &trueValue,
EnabledJobReady: &trueValue,
EnabledJobPipelined: &trueValue,
EnabledJobEnqueued: &trueValue,
EnabledTaskOrder: &trueValue,
EnabledPreemptable: &trueValue,
EnabledReclaimable: &trueValue,
Expand All @@ -71,6 +68,7 @@ tiers:
EnabledNamespaceOrder: &trueValue,
EnabledJobReady: &trueValue,
EnabledJobPipelined: &trueValue,
EnabledJobEnqueued: &trueValue,
EnabledTaskOrder: &trueValue,
EnabledPreemptable: &trueValue,
EnabledReclaimable: &trueValue,
Expand All @@ -89,6 +87,7 @@ tiers:
EnabledNamespaceOrder: &trueValue,
EnabledJobReady: &trueValue,
EnabledJobPipelined: &trueValue,
EnabledJobEnqueued: &trueValue,
EnabledTaskOrder: &trueValue,
EnabledPreemptable: &trueValue,
EnabledReclaimable: &trueValue,
Expand All @@ -111,6 +110,7 @@ tiers:
EnabledNamespaceOrder: &trueValue,
EnabledJobReady: &trueValue,
EnabledJobPipelined: &trueValue,
EnabledJobEnqueued: &trueValue,
EnabledTaskOrder: &trueValue,
EnabledPreemptable: &trueValue,
EnabledReclaimable: &trueValue,
Expand All @@ -129,6 +129,7 @@ tiers:
EnabledNamespaceOrder: &trueValue,
EnabledJobReady: &trueValue,
EnabledJobPipelined: &trueValue,
EnabledJobEnqueued: &trueValue,
EnabledTaskOrder: &trueValue,
EnabledPreemptable: &trueValue,
EnabledReclaimable: &trueValue,
Expand All @@ -147,6 +148,7 @@ tiers:
EnabledNamespaceOrder: &trueValue,
EnabledJobReady: &trueValue,
EnabledJobPipelined: &trueValue,
EnabledJobEnqueued: &trueValue,
EnabledTaskOrder: &trueValue,
EnabledPreemptable: &trueValue,
EnabledReclaimable: &trueValue,
Expand All @@ -165,6 +167,7 @@ tiers:
EnabledNamespaceOrder: &trueValue,
EnabledJobReady: &trueValue,
EnabledJobPipelined: &trueValue,
EnabledJobEnqueued: &trueValue,
EnabledTaskOrder: &trueValue,
EnabledPreemptable: &trueValue,
EnabledReclaimable: &trueValue,
Expand All @@ -181,14 +184,7 @@ tiers:
},
}

expectedConfigurations := []conf.Configuration{
{
Name: "enqueue",
Arguments: map[string]string{
"overcommit-factor": "1.5",
},
},
}
var expectedConfigurations []conf.Configuration

_, tiers, configurations, err := unmarshalSchedulerConf(configuration)
if err != nil {
Expand Down

0 comments on commit e721964

Please sign in to comment.