This is an automated email from the ASF dual-hosted git repository. chia7712 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git
The following commit(s) were added to refs/heads/master by this push: new f82113c1 [YUNIKORN-2658] add nolint:funlen to long functions to supress the lint warnings (#900) f82113c1 is described below commit f82113c1cac5ff40d424413e7c100f55261ece01 Author: rich7420 <rc910...@gmail.com> AuthorDate: Mon Jul 8 00:38:47 2024 +0800 [YUNIKORN-2658] add nolint:funlen to long functions to supress the lint warnings (#900) Closes: #900 Signed-off-by: Chia-Ping Tsai <chia7...@gmail.com> --- pkg/common/configs/config_test.go | 1 + pkg/common/configs/configvalidator_test.go | 1 + pkg/scheduler/objects/application_state.go | 269 ++++++++++++----------- pkg/scheduler/objects/application_test.go | 2 + pkg/scheduler/objects/preemption.go | 2 + pkg/scheduler/partition.go | 65 +++--- pkg/scheduler/partition_test.go | 3 + pkg/scheduler/placement/fixed_rule_test.go | 1 + pkg/scheduler/placement/provided_rule_test.go | 2 + pkg/scheduler/placement/tag_rule_test.go | 2 + pkg/scheduler/placement/user_rule_test.go | 1 + pkg/scheduler/tests/application_tracking_test.go | 1 + pkg/scheduler/tests/operation_test.go | 3 + pkg/scheduler/tests/performance_test.go | 1 + pkg/scheduler/tests/recovery_test.go | 4 + pkg/scheduler/tests/smoke_test.go | 3 + pkg/webservice/handlers_test.go | 1 + 17 files changed, 202 insertions(+), 160 deletions(-) diff --git a/pkg/common/configs/config_test.go b/pkg/common/configs/config_test.go index 2493be27..307a4479 100644 --- a/pkg/common/configs/config_test.go +++ b/pkg/common/configs/config_test.go @@ -1288,6 +1288,7 @@ partitions: } } +//nolint:funlen func TestLimitsFail(t *testing.T) { data := ` partitions: diff --git a/pkg/common/configs/configvalidator_test.go b/pkg/common/configs/configvalidator_test.go index 4a75ece5..82155c28 100644 --- a/pkg/common/configs/configvalidator_test.go +++ b/pkg/common/configs/configvalidator_test.go @@ -29,6 +29,7 @@ import ( "github.com/apache/yunikorn-core/pkg/common/resources" ) +//nolint:funlen func TestCheckResourceConfigurationsForQueue(t *testing.T) { negativeResourceMap := map[string]string{"memory": "-50", "vcores": "33"} resourceMapWithSyntaxError := map[string]string{"memory": "ten", "vcores": ""} diff --git a/pkg/scheduler/objects/application_state.go b/pkg/scheduler/objects/application_state.go index 4b4251fe..dc600850 100644 --- a/pkg/scheduler/objects/application_state.go +++ b/pkg/scheduler/objects/application_state.go @@ -90,141 +90,146 @@ func (as applicationState) String() string { return [...]string{"New", "Accepted", "Running", "Rejected", "Completing", "Completed", "Failing", "Failed", "Expired", "Resuming"}[as] } -func NewAppState() *fsm.FSM { - return fsm.NewFSM( - New.String(), fsm.Events{ - { - Name: RejectApplication.String(), - Src: []string{New.String()}, - Dst: Rejected.String(), - }, { - Name: RunApplication.String(), - Src: []string{New.String(), Resuming.String()}, - Dst: Accepted.String(), - }, { - Name: RunApplication.String(), - Src: []string{Accepted.String(), Running.String(), Completing.String()}, - Dst: Running.String(), - }, { - Name: CompleteApplication.String(), - Src: []string{Accepted.String(), Running.String()}, - Dst: Completing.String(), - }, { - Name: CompleteApplication.String(), - Src: []string{Completing.String()}, - Dst: Completed.String(), - }, { - Name: FailApplication.String(), - Src: []string{New.String(), Accepted.String(), Running.String()}, - Dst: Failing.String(), - }, { - Name: FailApplication.String(), - Src: []string{Failing.String()}, - Dst: Failed.String(), - }, { - Name: ResumeApplication.String(), - Src: []string{New.String(), Accepted.String()}, - Dst: Resuming.String(), - }, { - Name: ExpireApplication.String(), - Src: []string{Completed.String(), Failed.String(), Rejected.String()}, - Dst: Expired.String(), - }, +func eventDesc() fsm.Events { + return fsm.Events{ + { + Name: RejectApplication.String(), + Src: []string{New.String()}, + Dst: Rejected.String(), + }, { + Name: RunApplication.String(), + Src: []string{New.String(), Resuming.String()}, + Dst: Accepted.String(), + }, { + Name: RunApplication.String(), + Src: []string{Accepted.String(), Running.String(), Completing.String()}, + Dst: Running.String(), + }, { + Name: CompleteApplication.String(), + Src: []string{Accepted.String(), Running.String()}, + Dst: Completing.String(), + }, { + Name: CompleteApplication.String(), + Src: []string{Completing.String()}, + Dst: Completed.String(), + }, { + Name: FailApplication.String(), + Src: []string{New.String(), Accepted.String(), Running.String()}, + Dst: Failing.String(), + }, { + Name: FailApplication.String(), + Src: []string{Failing.String()}, + Dst: Failed.String(), + }, { + Name: ResumeApplication.String(), + Src: []string{New.String(), Accepted.String()}, + Dst: Resuming.String(), + }, { + Name: ExpireApplication.String(), + Src: []string{Completed.String(), Failed.String(), Rejected.String()}, + Dst: Expired.String(), }, - fsm.Callbacks{ - // The state machine is tightly tied to the Application object. - // - // The first argument must always be an Application and if there is a second, - // that must be a string. If this precondition is not met, a runtime panic - // will occur. - "enter_state": func(_ context.Context, event *fsm.Event) { - app := event.Args[0].(*Application) //nolint:errcheck - log.Log(log.SchedFSM).Info("Application state transition", - zap.String("appID", app.ApplicationID), - zap.String("source", event.Src), - zap.String("destination", event.Dst), - zap.String("event", event.Event)) - - eventInfo := "" - if len(event.Args) == 2 { - eventInfo = event.Args[1].(string) //nolint:errcheck - app.OnStateChange(event, eventInfo) - } else { - app.OnStateChange(event, "") - } - eventDetails, ok := stateEvents[event.Dst] - if !ok { - log.Log(log.SchedFSM).Error("event details not found", - zap.String("state", event.Dst)) - return - } - if app.sendStateChangeEvents { - app.appEvents.SendStateChangeEvent(app.ApplicationID, eventDetails, eventInfo) - } - }, - "leave_state": func(_ context.Context, event *fsm.Event) { - event.Args[0].(*Application).clearStateTimer() //nolint:errcheck - }, - fmt.Sprintf("enter_%s", Completing.String()): func(_ context.Context, event *fsm.Event) { - app := event.Args[0].(*Application) //nolint:errcheck - app.setStateTimer(completingTimeout, app.stateMachine.Current(), CompleteApplication) - }, - fmt.Sprintf("leave_%s", New.String()): func(_ context.Context, event *fsm.Event) { - if event.Dst != Rejected.String() { - app := event.Args[0].(*Application) //nolint:errcheck - metrics.GetQueueMetrics(app.queuePath).IncQueueApplicationsAccepted() - metrics.GetSchedulerMetrics().IncTotalApplicationsAccepted() - } - }, - fmt.Sprintf("enter_%s", Rejected.String()): func(_ context.Context, event *fsm.Event) { - app := event.Args[0].(*Application) //nolint:errcheck - metrics.GetQueueMetrics(app.queuePath).IncQueueApplicationsRejected() - metrics.GetSchedulerMetrics().IncTotalApplicationsRejected() - app.setStateTimer(terminatedTimeout, app.stateMachine.Current(), ExpireApplication) - app.finishedTime = time.Now() - app.cleanupTrackedResource() - // No rejected message when use app.HandleApplicationEvent(RejectApplication) - if len(event.Args) == 2 { - app.rejectedMessage = event.Args[1].(string) //nolint:errcheck - } - }, - fmt.Sprintf("enter_%s", Running.String()): func(_ context.Context, event *fsm.Event) { - if event.Src != Running.String() { - app := event.Args[0].(*Application) //nolint:errcheck - app.startTime = time.Now() - app.queue.incRunningApps(app.ApplicationID) - metrics.GetQueueMetrics(app.queuePath).IncQueueApplicationsRunning() - metrics.GetSchedulerMetrics().IncTotalApplicationsRunning() - } - }, - fmt.Sprintf("leave_%s", Running.String()): func(_ context.Context, event *fsm.Event) { - if event.Dst != Running.String() { - app := event.Args[0].(*Application) //nolint:errcheck - app.queue.decRunningApps() - metrics.GetQueueMetrics(app.queuePath).DecQueueApplicationsRunning() - metrics.GetSchedulerMetrics().DecTotalApplicationsRunning() - } - }, - fmt.Sprintf("enter_%s", Completed.String()): func(_ context.Context, event *fsm.Event) { + } +} + +// The state machine is tightly tied to the Application object. +// +// The first argument must always be an Application and if there is a second, +// that must be a string. If this precondition is not met, a runtime panic +// will occur. +func callbacks() fsm.Callbacks { + return fsm.Callbacks{ + "enter_state": func(_ context.Context, event *fsm.Event) { + app := event.Args[0].(*Application) //nolint:errcheck + log.Log(log.SchedFSM).Info("Application state transition", + zap.String("appID", app.ApplicationID), + zap.String("source", event.Src), + zap.String("destination", event.Dst), + zap.String("event", event.Event)) + + eventInfo := "" + if len(event.Args) == 2 { + eventInfo = event.Args[1].(string) //nolint:errcheck + app.OnStateChange(event, eventInfo) + } else { + app.OnStateChange(event, "") + } + eventDetails, ok := stateEvents[event.Dst] + if !ok { + log.Log(log.SchedFSM).Error("event details not found", + zap.String("state", event.Dst)) + return + } + if app.sendStateChangeEvents { + app.appEvents.SendStateChangeEvent(app.ApplicationID, eventDetails, eventInfo) + } + }, + "leave_state": func(_ context.Context, event *fsm.Event) { + event.Args[0].(*Application).clearStateTimer() //nolint:errcheck + }, + fmt.Sprintf("enter_%s", Completing.String()): func(_ context.Context, event *fsm.Event) { + app := event.Args[0].(*Application) //nolint:errcheck + app.setStateTimer(completingTimeout, app.stateMachine.Current(), CompleteApplication) + }, + fmt.Sprintf("leave_%s", New.String()): func(_ context.Context, event *fsm.Event) { + if event.Dst != Rejected.String() { app := event.Args[0].(*Application) //nolint:errcheck - metrics.GetSchedulerMetrics().IncTotalApplicationsCompleted() - metrics.GetQueueMetrics(app.queuePath).IncQueueApplicationsCompleted() - app.setStateTimer(terminatedTimeout, app.stateMachine.Current(), ExpireApplication) - app.executeTerminatedCallback() - app.clearPlaceholderTimer() - app.cleanupAsks() - }, - fmt.Sprintf("enter_%s", Failing.String()): func(_ context.Context, event *fsm.Event) { + metrics.GetQueueMetrics(app.queuePath).IncQueueApplicationsAccepted() + metrics.GetSchedulerMetrics().IncTotalApplicationsAccepted() + } + }, + fmt.Sprintf("enter_%s", Rejected.String()): func(_ context.Context, event *fsm.Event) { + app := event.Args[0].(*Application) //nolint:errcheck + metrics.GetQueueMetrics(app.queuePath).IncQueueApplicationsRejected() + metrics.GetSchedulerMetrics().IncTotalApplicationsRejected() + app.setStateTimer(terminatedTimeout, app.stateMachine.Current(), ExpireApplication) + app.finishedTime = time.Now() + app.cleanupTrackedResource() + // No rejected message when use app.HandleApplicationEvent(RejectApplication) + if len(event.Args) == 2 { + app.rejectedMessage = event.Args[1].(string) //nolint:errcheck + } + }, + fmt.Sprintf("enter_%s", Running.String()): func(_ context.Context, event *fsm.Event) { + if event.Src != Running.String() { app := event.Args[0].(*Application) //nolint:errcheck - metrics.GetQueueMetrics(app.queuePath).IncQueueApplicationsFailed() - metrics.GetSchedulerMetrics().IncTotalApplicationsFailed() - }, - fmt.Sprintf("enter_%s", Failed.String()): func(_ context.Context, event *fsm.Event) { + app.startTime = time.Now() + app.queue.incRunningApps(app.ApplicationID) + metrics.GetQueueMetrics(app.queuePath).IncQueueApplicationsRunning() + metrics.GetSchedulerMetrics().IncTotalApplicationsRunning() + } + }, + fmt.Sprintf("leave_%s", Running.String()): func(_ context.Context, event *fsm.Event) { + if event.Dst != Running.String() { app := event.Args[0].(*Application) //nolint:errcheck - app.setStateTimer(terminatedTimeout, app.stateMachine.Current(), ExpireApplication) - app.executeTerminatedCallback() - app.cleanupAsks() - }, + app.queue.decRunningApps() + metrics.GetQueueMetrics(app.queuePath).DecQueueApplicationsRunning() + metrics.GetSchedulerMetrics().DecTotalApplicationsRunning() + } + }, + fmt.Sprintf("enter_%s", Completed.String()): func(_ context.Context, event *fsm.Event) { + app := event.Args[0].(*Application) //nolint:errcheck + metrics.GetSchedulerMetrics().IncTotalApplicationsCompleted() + metrics.GetQueueMetrics(app.queuePath).IncQueueApplicationsCompleted() + app.setStateTimer(terminatedTimeout, app.stateMachine.Current(), ExpireApplication) + app.executeTerminatedCallback() + app.clearPlaceholderTimer() + app.cleanupAsks() + }, + fmt.Sprintf("enter_%s", Failing.String()): func(_ context.Context, event *fsm.Event) { + app := event.Args[0].(*Application) //nolint:errcheck + metrics.GetQueueMetrics(app.queuePath).IncQueueApplicationsFailed() + metrics.GetSchedulerMetrics().IncTotalApplicationsFailed() }, - ) + fmt.Sprintf("enter_%s", Failed.String()): func(_ context.Context, event *fsm.Event) { + app := event.Args[0].(*Application) //nolint:errcheck + app.setStateTimer(terminatedTimeout, app.stateMachine.Current(), ExpireApplication) + app.executeTerminatedCallback() + app.cleanupAsks() + }, + } +} + +func NewAppState() *fsm.FSM { + return fsm.NewFSM(New.String(), eventDesc(), callbacks()) } diff --git a/pkg/scheduler/objects/application_test.go b/pkg/scheduler/objects/application_test.go index bb84a900..2979b91f 100644 --- a/pkg/scheduler/objects/application_test.go +++ b/pkg/scheduler/objects/application_test.go @@ -374,6 +374,8 @@ func TestAllocateDeallocate(t *testing.T) { } // test pending calculation and ask addition +// +//nolint:funlen func TestAddAllocAsk(t *testing.T) { app := newApplication(appID1, "default", "root.unknown") // Create event system after new application to avoid new application event. diff --git a/pkg/scheduler/objects/preemption.go b/pkg/scheduler/objects/preemption.go index 0f183130..57ca883c 100644 --- a/pkg/scheduler/objects/preemption.go +++ b/pkg/scheduler/objects/preemption.go @@ -208,6 +208,8 @@ func (p *Preemptor) checkPreemptionQueueGuarantees() bool { // calculateVictimsByNode takes a list of potential victims for a node and builds a list ready for the RM to process. // Result is a list of allocations and the starting index to check for the initial preemption list. // If the resultType is nil, the node should not be considered for preemption. +// +//nolint:funlen func (p *Preemptor) calculateVictimsByNode(nodeAvailable *resources.Resource, potentialVictims []*Allocation) (int, []*Allocation) { nodeCurrentAvailable := nodeAvailable.Clone() allocationsByQueueSnap := p.duplicateQueueSnapshots() diff --git a/pkg/scheduler/partition.go b/pkg/scheduler/partition.go index 01e0f39a..ed4b03bb 100644 --- a/pkg/scheduler/partition.go +++ b/pkg/scheduler/partition.go @@ -1239,49 +1239,26 @@ func (pc *PartitionContext) calculateNodesResourceUsage() map[string][]int { return mapResult } -// removeAllocation removes the referenced allocation(s) from the applications and nodes -// NOTE: this is a lock free call. It must NOT be called holding the PartitionContext lock. -func (pc *PartitionContext) removeAllocation(release *si.AllocationRelease) ([]*objects.Allocation, *objects.Allocation) { - if release == nil { - return nil, nil - } - appID := release.ApplicationID - allocationKey := release.GetAllocationKey() - app := pc.getApplication(appID) - // no app nothing to do everything should already be clean - if app == nil { - log.Log(log.SchedPartition).Info("Application not found while releasing allocation", - zap.String("appID", appID), - zap.String("allocationKey", allocationKey), - zap.Stringer("terminationType", release.TerminationType)) - return nil, nil - } - // Processing a removal while in the Completing state could race with the state change. - // The race occurs between removing the allocation and updating the queue after node processing. - // If the state change removes the queue link before we get to updating the queue after the node we - // leave the resources as allocated on the queue. The queue cannot be removed yet at this point as - // there are still allocations left. So retrieve the queue early to sidestep the race. - queue := app.GetQueue() - // temp store for allocations manipulated +func (pc *PartitionContext) generateReleased(release *si.AllocationRelease, app *objects.Application) []*objects.Allocation { released := make([]*objects.Allocation, 0) - var confirmed *objects.Allocation // when allocationKey is not specified, remove all allocations from the app + allocationKey := release.GetAllocationKey() if allocationKey == "" { log.Log(log.SchedPartition).Info("remove all allocations", - zap.String("appID", appID)) + zap.String("appID", app.ApplicationID)) released = append(released, app.RemoveAllAllocations()...) } else { // if we have an allocationKey the termination type is important if release.TerminationType == si.TerminationType_PLACEHOLDER_REPLACED { log.Log(log.SchedPartition).Info("replacing placeholder allocation", - zap.String("appID", appID), + zap.String("appID", app.ApplicationID), zap.String("allocationKey", allocationKey)) if alloc := app.ReplaceAllocation(allocationKey); alloc != nil { released = append(released, alloc) } } else { log.Log(log.SchedPartition).Info("removing allocation from application", - zap.String("appID", appID), + zap.String("appID", app.ApplicationID), zap.String("allocationKey", allocationKey), zap.Stringer("terminationType", release.TerminationType)) if alloc := app.RemoveAllocation(allocationKey, release.TerminationType); alloc != nil { @@ -1289,6 +1266,30 @@ func (pc *PartitionContext) removeAllocation(release *si.AllocationRelease) ([]* } } } + return released +} + +// removeAllocation removes the referenced allocation(s) from the applications and nodes +// NOTE: this is a lock free call. It must NOT be called holding the PartitionContext lock. +func (pc *PartitionContext) removeAllocation(release *si.AllocationRelease) ([]*objects.Allocation, *objects.Allocation) { + if release == nil { + return nil, nil + } + appID := release.ApplicationID + allocationKey := release.GetAllocationKey() + app := pc.getApplication(appID) + // no app nothing to do everything should already be clean + if app == nil { + log.Log(log.SchedPartition).Info("Application not found while releasing allocation", + zap.String("appID", appID), + zap.String("allocationId", allocationKey), + zap.Stringer("terminationType", release.TerminationType)) + return nil, nil + } + + // temp store for allocations manipulated + released := pc.generateReleased(release, app) + var confirmed *objects.Allocation // all releases are collected: placeholder count needs updating for all placeholder releases // regardless of what happens later @@ -1354,6 +1355,14 @@ func (pc *PartitionContext) removeAllocation(release *si.AllocationRelease) ([]* totalPreempting.AddTo(alloc.GetAllocatedResource()) } } + + // Processing a removal while in the Completing state could race with the state change. + // The race occurs between removing the allocation and updating the queue after node processing. + // If the state change removes the queue link before we get to updating the queue after the node we + // leave the resources as allocated on the queue. The queue cannot be removed yet at this point as + // there are still allocations left. So retrieve the queue early to sidestep the race. + queue := app.GetQueue() + if resources.StrictlyGreaterThanZero(total) { if err := queue.DecAllocatedResource(total); err != nil { log.Log(log.SchedPartition).Warn("failed to release resources from queue", diff --git a/pkg/scheduler/partition_test.go b/pkg/scheduler/partition_test.go index 7a014c4a..e3932187 100644 --- a/pkg/scheduler/partition_test.go +++ b/pkg/scheduler/partition_test.go @@ -3301,6 +3301,8 @@ func TestPreemptedPlaceholderSkip(t *testing.T) { } // simple direct replace with one node +// +//nolint:funlen func TestTryPlaceholderAllocate(t *testing.T) { setupUGM() partition, err := newBasePartition() @@ -3845,6 +3847,7 @@ func TestNewQueueEvents(t *testing.T) { assert.Equal(t, "root.test", records[2].ObjectID) } +//nolint:funlen func TestUserHeadroom(t *testing.T) { setupUGM() partition, err := newConfiguredPartition() diff --git a/pkg/scheduler/placement/fixed_rule_test.go b/pkg/scheduler/placement/fixed_rule_test.go index 2e68ac6d..22bf025f 100644 --- a/pkg/scheduler/placement/fixed_rule_test.go +++ b/pkg/scheduler/placement/fixed_rule_test.go @@ -124,6 +124,7 @@ partitions: } } +//nolint:funlen func TestFixedRuleParent(t *testing.T) { err := initQueueStructure([]byte(confParentChild)) assert.NilError(t, err, "setting up the queue config failed") diff --git a/pkg/scheduler/placement/provided_rule_test.go b/pkg/scheduler/placement/provided_rule_test.go index 82a496d9..cc2f8c77 100644 --- a/pkg/scheduler/placement/provided_rule_test.go +++ b/pkg/scheduler/placement/provided_rule_test.go @@ -28,6 +28,7 @@ import ( "github.com/apache/yunikorn-core/pkg/webservice/dao" ) +//nolint:funlen func TestProvidedRulePlace(t *testing.T) { // Create the structure for the test data := ` @@ -155,6 +156,7 @@ partitions: } } +//nolint:funlen func TestProvidedRuleParent(t *testing.T) { err := initQueueStructure([]byte(confParentChild)) assert.NilError(t, err, "setting up the queue config failed") diff --git a/pkg/scheduler/placement/tag_rule_test.go b/pkg/scheduler/placement/tag_rule_test.go index 6dff1a2b..5d87a5ac 100644 --- a/pkg/scheduler/placement/tag_rule_test.go +++ b/pkg/scheduler/placement/tag_rule_test.go @@ -60,6 +60,7 @@ func TestTagRule(t *testing.T) { } } +//nolint:funlen func TestTagRulePlace(t *testing.T) { // Create the structure for the test data := ` @@ -196,6 +197,7 @@ partitions: } } +//nolint:funlen func TestTagRuleParent(t *testing.T) { err := initQueueStructure([]byte(confParentChild)) assert.NilError(t, err, "setting up the queue config failed") diff --git a/pkg/scheduler/placement/user_rule_test.go b/pkg/scheduler/placement/user_rule_test.go index 1b686029..da6b3b93 100644 --- a/pkg/scheduler/placement/user_rule_test.go +++ b/pkg/scheduler/placement/user_rule_test.go @@ -87,6 +87,7 @@ partitions: } } +//nolint:funlen func TestUserRuleParent(t *testing.T) { err := initQueueStructure([]byte(confParentChild)) assert.NilError(t, err, "setting up the queue config failed") diff --git a/pkg/scheduler/tests/application_tracking_test.go b/pkg/scheduler/tests/application_tracking_test.go index ea0deb6b..cda2a1ce 100644 --- a/pkg/scheduler/tests/application_tracking_test.go +++ b/pkg/scheduler/tests/application_tracking_test.go @@ -45,6 +45,7 @@ partitions: - name: singleleaf ` +//nolint:funlen func TestApplicationHistoryTracking(t *testing.T) { // Register RM ms := &mockScheduler{} diff --git a/pkg/scheduler/tests/operation_test.go b/pkg/scheduler/tests/operation_test.go index 2fbd3b68..17f51a81 100644 --- a/pkg/scheduler/tests/operation_test.go +++ b/pkg/scheduler/tests/operation_test.go @@ -32,6 +32,8 @@ import ( // this test simulates the scenario the cluster starts up with 0 nodes // then we submit an app, the app tasks will be pending; then we add a // node to the cluster, then we see the app gets the allocation it needed. +// +//nolint:funlen func TestSchedulerWithoutNodes(t *testing.T) { // Register RM configData := ` @@ -169,6 +171,7 @@ partitions: ms.mockRM.waitForAllocations(t, 2, 1000) } +//nolint:funlen func TestAddRemoveNodes(t *testing.T) { // Register RM configData := ` diff --git a/pkg/scheduler/tests/performance_test.go b/pkg/scheduler/tests/performance_test.go index bfbdc852..9cda5bf8 100644 --- a/pkg/scheduler/tests/performance_test.go +++ b/pkg/scheduler/tests/performance_test.go @@ -31,6 +31,7 @@ import ( "github.com/apache/yunikorn-scheduler-interface/lib/go/si" ) +//nolint:funlen func benchmarkScheduling(b *testing.B, numNodes, numPods int) { log.UpdateLoggingConfig(map[string]string{"log.level": "WARN"}) defer log.UpdateLoggingConfig(nil) diff --git a/pkg/scheduler/tests/recovery_test.go b/pkg/scheduler/tests/recovery_test.go index 8b657155..09c8d4f4 100644 --- a/pkg/scheduler/tests/recovery_test.go +++ b/pkg/scheduler/tests/recovery_test.go @@ -458,6 +458,8 @@ func TestSchedulerRecovery2Allocations(t *testing.T) { // test scheduler recovery when shim doesn't report existing application // but only include existing allocations of this app. +// +//nolint:funlen func TestSchedulerRecoveryWithoutAppInfo(t *testing.T) { // Register RM ms := &mockScheduler{} @@ -716,6 +718,8 @@ func TestAppRecoveryAlone(t *testing.T) { // new allocations. But during the recovery, when we recover existing // allocations on node, we need to ensure the placement rule is still // enforced. +// +//nolint:funlen func TestAppRecoveryPlacement(t *testing.T) { // Register RM configData := ` diff --git a/pkg/scheduler/tests/smoke_test.go b/pkg/scheduler/tests/smoke_test.go index 8051d29a..dff62e3f 100644 --- a/pkg/scheduler/tests/smoke_test.go +++ b/pkg/scheduler/tests/smoke_test.go @@ -157,6 +157,8 @@ partitions: } // Test basic interactions from rm proxy to cache and to scheduler. +// +//nolint:funlen func TestBasicScheduler(t *testing.T) { // Register RM // Start all tests @@ -794,6 +796,7 @@ partitions: ms.mockRM.waitForAcceptedApplication(t, "app-added-2", 1000) } +//nolint:funlen func TestSchedulingOverMaxCapacity(t *testing.T) { var parameters = []struct { name string diff --git a/pkg/webservice/handlers_test.go b/pkg/webservice/handlers_test.go index 169cca86..406426bf 100644 --- a/pkg/webservice/handlers_test.go +++ b/pkg/webservice/handlers_test.go @@ -1073,6 +1073,7 @@ func TestMetricsNotEmpty(t *testing.T) { assert.Assert(t, len(rr.Body.Bytes()) > 0, "Metrics response should not be empty") } +//nolint:funlen func TestGetPartitionQueuesHandler(t *testing.T) { setup(t, configTwoLevelQueues, 2) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@yunikorn.apache.org For additional commands, e-mail: issues-h...@yunikorn.apache.org