diff --git a/example/custom-plugin/go.mod b/example/custom-plugin/go.mod index 07899c3f84e..cb2d7aa2f04 100644 --- a/example/custom-plugin/go.mod +++ b/example/custom-plugin/go.mod @@ -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 \ No newline at end of file +require volcano.sh/volcano v1.1.0 diff --git a/installer/helm/chart/volcano/config/volcano-scheduler-ci.conf b/installer/helm/chart/volcano/config/volcano-scheduler-ci.conf index 31f8f1a6872..a826b4dedc0 100644 --- a/installer/helm/chart/volcano/config/volcano-scheduler-ci.conf +++ b/installer/helm/chart/volcano/config/volcano-scheduler-ci.conf @@ -5,6 +5,7 @@ tiers: - name: gang - name: conformance - plugins: + - name: overcommit - name: drf - name: predicates - name: proportion diff --git a/pkg/scheduler/actions/enqueue/enqueue.go b/pkg/scheduler/actions/enqueue/enqueue.go index a09daf5903e..23e7fd55f75 100644 --- a/pkg/scheduler/actions/enqueue/enqueue.go +++ b/pkg/scheduler/actions/enqueue/enqueue.go @@ -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 } @@ -102,4 +102,3 @@ func (enqueue *Action) Execute(ssn *framework.Session) { } func (enqueue *Action) UnInitialize() {} - diff --git a/pkg/scheduler/actions/enqueue/enqueue_test.go b/pkg/scheduler/actions/enqueue/enqueue_test.go deleted file mode 100644 index eb267bb85e5..00000000000 --- a/pkg/scheduler/actions/enqueue/enqueue_test.go +++ /dev/null @@ -1,3 +0,0 @@ -package enqueue - - diff --git a/pkg/scheduler/framework/session.go b/pkg/scheduler/framework/session.go index af0b7a58d0c..9f5f72e459b 100644 --- a/pkg/scheduler/framework/session.go +++ b/pkg/scheduler/framework/session.go @@ -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 @@ -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{}, diff --git a/pkg/scheduler/plugins/overcommit/overcommit.go b/pkg/scheduler/plugins/overcommit/overcommit.go index 9b2c5231d75..44cdf1dfa29 100644 --- a/pkg/scheduler/plugins/overcommit/overcommit.go +++ b/pkg/scheduler/plugins/overcommit/overcommit.go @@ -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, @@ -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)) @@ -102,4 +104,4 @@ func (op *overcommitPlugin) OnSessionOpen(ssn *framework.Session) { func (op *overcommitPlugin) OnSessionClose(ssn *framework.Session) { op.idleResource = nil op.inqueueResource = nil -} \ No newline at end of file +} diff --git a/pkg/scheduler/util_test.go b/pkg/scheduler/util_test.go index 79ea5af58c0..8e6477a290c 100644 --- a/pkg/scheduler/util_test.go +++ b/pkg/scheduler/util_test.go @@ -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 @@ -53,6 +49,7 @@ tiers: EnabledNamespaceOrder: &trueValue, EnabledJobReady: &trueValue, EnabledJobPipelined: &trueValue, + EnabledJobEnqueued: &trueValue, EnabledTaskOrder: &trueValue, EnabledPreemptable: &trueValue, EnabledReclaimable: &trueValue, @@ -71,6 +68,7 @@ tiers: EnabledNamespaceOrder: &trueValue, EnabledJobReady: &trueValue, EnabledJobPipelined: &trueValue, + EnabledJobEnqueued: &trueValue, EnabledTaskOrder: &trueValue, EnabledPreemptable: &trueValue, EnabledReclaimable: &trueValue, @@ -89,6 +87,7 @@ tiers: EnabledNamespaceOrder: &trueValue, EnabledJobReady: &trueValue, EnabledJobPipelined: &trueValue, + EnabledJobEnqueued: &trueValue, EnabledTaskOrder: &trueValue, EnabledPreemptable: &trueValue, EnabledReclaimable: &trueValue, @@ -111,6 +110,7 @@ tiers: EnabledNamespaceOrder: &trueValue, EnabledJobReady: &trueValue, EnabledJobPipelined: &trueValue, + EnabledJobEnqueued: &trueValue, EnabledTaskOrder: &trueValue, EnabledPreemptable: &trueValue, EnabledReclaimable: &trueValue, @@ -129,6 +129,7 @@ tiers: EnabledNamespaceOrder: &trueValue, EnabledJobReady: &trueValue, EnabledJobPipelined: &trueValue, + EnabledJobEnqueued: &trueValue, EnabledTaskOrder: &trueValue, EnabledPreemptable: &trueValue, EnabledReclaimable: &trueValue, @@ -147,6 +148,7 @@ tiers: EnabledNamespaceOrder: &trueValue, EnabledJobReady: &trueValue, EnabledJobPipelined: &trueValue, + EnabledJobEnqueued: &trueValue, EnabledTaskOrder: &trueValue, EnabledPreemptable: &trueValue, EnabledReclaimable: &trueValue, @@ -165,6 +167,7 @@ tiers: EnabledNamespaceOrder: &trueValue, EnabledJobReady: &trueValue, EnabledJobPipelined: &trueValue, + EnabledJobEnqueued: &trueValue, EnabledTaskOrder: &trueValue, EnabledPreemptable: &trueValue, EnabledReclaimable: &trueValue, @@ -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 {