Achilleas Tzenetopoulos 5 years ago
parent
commit
512b84870e

+ 13 - 1
kubernetes-v1.15.4/pkg/scheduler/core/generic_scheduler.go

@@ -222,7 +222,7 @@ func (g *genericScheduler) Schedule(pod *v1.Pod, nodeLister algorithm.NodeLister
 	metrics.DeprecatedSchedulingLatency.WithLabelValues(metrics.PredicateEvaluation).Observe(metrics.SinceInSeconds(startPredicateEvalTime))
 
 	//trace.Step("Prioritizing")
-	trace.Step("Prioritizing Sockets")
+	//trace.Step("Prioritizing Sockets")
 
 	startPriorityEvalTime := time.Now()
 	// When only one node after predicate, just use it.
@@ -243,6 +243,18 @@ func (g *genericScheduler) Schedule(pod *v1.Pod, nodeLister algorithm.NodeLister
 	// default
 
 	//start-custom
+
+	select {
+	// clean the cache if 10 seconds are passed
+	case <-customcache.LabCache.Timeout.C:
+		klog.Infof("Time to erase: %v", time.Now())
+		//customcache.LabCache.Timeout.Stop()
+		customcache.LabCache.CleanCache()
+		klog.Infof("Cache: %v", customcache.LabCache.Cache)
+	default:
+		klog.Infof("Cache is Valid, Time: %v", customcache.LabCache.Timeout.C)
+	}
+
 	socketPrioritizers := []priorities.PriorityConfig{
 		{
 			Name:   priorities.CustomRequestedPriority,

+ 11 - 11
kubernetes-v1.15.4/pkg/scheduler/scheduler.go

@@ -40,7 +40,7 @@ import (
 	"k8s.io/kubernetes/pkg/scheduler/core"
 
 	// "k8s.io/kubernetes/pkg/scheduler/customcache"
-	"github.com/iwita/kube-scheduler/customcache"
+	// "github.com/iwita/kube-scheduler/customcache"
 
 	"k8s.io/kubernetes/pkg/scheduler/factory"
 	framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
@@ -458,16 +458,16 @@ func (sched *Scheduler) scheduleOne() {
 
 	//Check if the cache needs update
 	//klog.Infof("The value of the Ticker: %v", customcache.LabCache.Timeout.C)
-	select {
-	// clean the cache if 10 seconds are passed
-	case <-customcache.LabCache.Timeout.C:
-		klog.Infof("Time to erase: %v", time.Now())
-		//customcache.LabCache.Timeout.Stop()
-		customcache.LabCache.CleanCache()
-		klog.Infof("Cache: %v", customcache.LabCache.Cache)
-	default:
-		klog.Infof("Cache is Valid, Time: %v", customcache.LabCache.Timeout.C)
-	}
+	// select {
+	// // clean the cache if 10 seconds are passed
+	// case <-customcache.LabCache.Timeout.C:
+	// 	klog.Infof("Time to erase: %v", time.Now())
+	// 	//customcache.LabCache.Timeout.Stop()
+	// 	customcache.LabCache.CleanCache()
+	// 	klog.Infof("Cache: %v", customcache.LabCache.Cache)
+	// default:
+	// 	klog.Infof("Cache is Valid, Time: %v", customcache.LabCache.Timeout.C)
+	// }
 	fwk := sched.config.Framework
 
 	pod := sched.config.NextPod()