diff --git a/pkg/common/configs/configvalidator.go b/pkg/common/configs/configvalidator.go index 571e37b4b..4065cf865 100644 --- a/pkg/common/configs/configvalidator.go +++ b/pkg/common/configs/configvalidator.go @@ -21,8 +21,6 @@ package configs import ( "fmt" "math" - "os" - "path/filepath" "regexp" "strings" "time" @@ -725,13 +723,6 @@ func checkDeprecatedStateDumpFilePath(partition *PartitionConfig) error { return nil } -func ensureDir(fileName string) error { - if err := os.MkdirAll(filepath.Dir(fileName), os.ModePerm); err != nil { - return err - } - return nil -} - // Check the partition configuration. Any parsing issues will return an error which means that the // configuration is invalid. This *must* be called before the configuration is activated. Any // configuration that does not pass must be rejected. diff --git a/pkg/rmproxy/rmproxy.go b/pkg/rmproxy/rmproxy.go index 6a7501e2b..97c4042c7 100644 --- a/pkg/rmproxy/rmproxy.go +++ b/pkg/rmproxy/rmproxy.go @@ -407,23 +407,3 @@ func (rmp *RMProxy) UpdateConfiguration(request *si.UpdateConfigurationRequest) } return nil } - -// actual configuration reloader -type configurationReloader struct { - rmID string - rmProxy *RMProxy -} - -func (cr configurationReloader) DoReloadConfiguration() error { - c := make(chan *rmevent.Result) - cr.rmProxy.EventHandlers.SchedulerEventHandler.HandleEvent( - &rmevent.RMConfigUpdateEvent{ - RmID: cr.rmID, - Channel: c, - }) - result := <-c - if !result.Succeeded { - return fmt.Errorf("failed to update configuration for RM %s, result: %v", cr.rmID, result) - } - return nil -} diff --git a/pkg/scheduler/context_test.go b/pkg/scheduler/context_test.go index e603bd9dc..9023525bf 100644 --- a/pkg/scheduler/context_test.go +++ b/pkg/scheduler/context_test.go @@ -51,12 +51,6 @@ func newMockEventHandler() *mockEventHandler { } } -func (m *mockEventHandler) reset() { - m.eventHandled = false - m.rejectedNodes = make([]*si.RejectedNode, 0) - m.acceptedNodes = make([]*si.AcceptedNode, 0) -} - func (m *mockEventHandler) HandleEvent(ev interface{}) { if nodeEvent, ok := ev.(*rmevent.RMNodeUpdateEvent); ok { m.eventHandled = true diff --git a/pkg/scheduler/health_checker.go b/pkg/scheduler/health_checker.go index 0794adcb3..4019a89c7 100644 --- a/pkg/scheduler/health_checker.go +++ b/pkg/scheduler/health_checker.go @@ -33,8 +33,6 @@ import ( "github.com/apache/yunikorn-core/pkg/webservice/dao" ) -const defaultPeriod = 30 * time.Second - type HealthChecker struct { context *ClusterContext confWatcherId string diff --git a/pkg/scheduler/objects/sorters_test.go b/pkg/scheduler/objects/sorters_test.go index 3474f0a8b..10ed5a6c1 100644 --- a/pkg/scheduler/objects/sorters_test.go +++ b/pkg/scheduler/objects/sorters_test.go @@ -404,15 +404,6 @@ func assertAppList(t *testing.T, list []*Application, place []int, name string) assert.Equal(t, "app-3", list[place[3]].ApplicationID, "test name: %s", name) } -// list of application and the location of the named applications inside that list -// place[0] defines the location of the app-0 in the list of applications -func assertAskList(t *testing.T, list []*AllocationAsk, place []int, name string) { - assert.Equal(t, "ask-0", list[place[0]].GetAllocationKey(), "test name: %s", name) - assert.Equal(t, "ask-1", list[place[1]].GetAllocationKey(), "test name: %s", name) - assert.Equal(t, "ask-2", list[place[2]].GetAllocationKey(), "test name: %s", name) - assert.Equal(t, "ask-3", list[place[3]].GetAllocationKey(), "test name: %s", name) -} - func assertAppListLength(t *testing.T, list []*Application, apps []string, name string) { assert.Equal(t, len(apps), len(list), "length of list differs, test: %s", name) for i, app := range list { diff --git a/pkg/scheduler/partition.go b/pkg/scheduler/partition.go index e6d2cad7a..81d09fc54 100644 --- a/pkg/scheduler/partition.go +++ b/pkg/scheduler/partition.go @@ -254,10 +254,6 @@ func (pc *PartitionContext) isDraining() bool { return pc.stateMachine.Current() == objects.Draining.String() } -func (pc *PartitionContext) isRunning() bool { - return pc.stateMachine.Current() == objects.Active.String() -} - func (pc *PartitionContext) isStopped() bool { return pc.stateMachine.Current() == objects.Stopped.String() } diff --git a/pkg/scheduler/partition_test.go b/pkg/scheduler/partition_test.go index bc3f411d7..186fa315a 100644 --- a/pkg/scheduler/partition_test.go +++ b/pkg/scheduler/partition_test.go @@ -1168,6 +1168,7 @@ func TestRemoveAppAllocs(t *testing.T) { ask := newAllocationAsk("alloc-nr", appNotRemoved, appRes) alloc := objects.NewAllocation("alloc-nr-uuid", nodeID1, ask) err = partition.addAllocation(alloc) + assert.NilError(t, err, "add allocation to partition should not have failed") assertLimits(t, getTestUserGroup(), appRes) ask = newAllocationAsk("alloc-1", appNotRemoved, appRes) diff --git a/pkg/scheduler/tests/operation_test.go b/pkg/scheduler/tests/operation_test.go index f2be70e19..1e7f94c77 100644 --- a/pkg/scheduler/tests/operation_test.go +++ b/pkg/scheduler/tests/operation_test.go @@ -68,7 +68,7 @@ partitions: // Check scheduling queue a queueA := part.GetQueue("root.a") - assert.Assert(t, 150000000 == queueA.GetMaxResource().Resources[common.Memory]) + assert.Equal(t, resources.Quantity(150000000), queueA.GetMaxResource().Resources[common.Memory]) // Add one application err = ms.proxy.UpdateApplication(&si.ApplicationRequest{ @@ -196,7 +196,7 @@ partitions: // Check scheduling queue a queueA := part.GetQueue("root.a") - assert.Assert(t, 150000000 == queueA.GetMaxResource().Resources[common.Memory]) + assert.Equal(t, resources.Quantity(150000000), queueA.GetMaxResource().Resources[common.Memory]) // Add one application err = ms.proxy.UpdateApplication(&si.ApplicationRequest{ diff --git a/pkg/scheduler/tests/recovery_test.go b/pkg/scheduler/tests/recovery_test.go index 81415a63f..94aba2f15 100644 --- a/pkg/scheduler/tests/recovery_test.go +++ b/pkg/scheduler/tests/recovery_test.go @@ -71,7 +71,7 @@ func TestSchedulerRecovery(t *testing.T) { // Check scheduling queue a queue := part.GetQueue("root.a") - assert.Assert(t, 150 == queue.GetMaxResource().Resources[common.Memory]) + assert.Equal(t, resources.Quantity(150), queue.GetMaxResource().Resources[common.Memory]) // Register nodes, and add apps err = ms.proxy.UpdateNode(&si.NodeRequest{ diff --git a/pkg/webservice/handlers_test.go b/pkg/webservice/handlers_test.go index e4e50bfd3..be4166ff1 100644 --- a/pkg/webservice/handlers_test.go +++ b/pkg/webservice/handlers_test.go @@ -255,7 +255,6 @@ const rmID = "rm-123" const policyGroup = "default-policy-group" const queueName = "root.default" const nodeID = "node-1" -const instType = "itype-1" var ( updatedExtraConf = map[string]string{ diff --git a/pkg/webservice/webservice.go b/pkg/webservice/webservice.go index 05e56ecab..ed5cef870 100644 --- a/pkg/webservice/webservice.go +++ b/pkg/webservice/webservice.go @@ -21,7 +21,6 @@ package webservice import ( "context" "net/http" - "sync" "time" "github.com/julienschmidt/httprouter" @@ -34,7 +33,6 @@ import ( ) var imHistory *history.InternalMetricsHistory -var lock sync.RWMutex var schedulerContext *scheduler.ClusterContext type WebService struct {