Skip to content

Commit bafbde4

Browse files
committed
feat: remove old checkpoint file
feat: remove old checkpoint file feat: remove old checkpoint file revert: sysadvisor changes feat: refactor chore: format
1 parent 264e848 commit bafbde4

File tree

21 files changed

+308
-228
lines changed

21 files changed

+308
-228
lines changed

cmd/katalyst-agent/app/options/qrm/qrm_base.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,31 @@ limitations under the License.
1717
package qrm
1818

1919
import (
20+
"github.com/kubewharf/katalyst-core/cmd/katalyst-agent/app/options/qrm/statedirectory"
2021
cliflag "k8s.io/component-base/cli/flag"
2122

2223
qrmconfig "github.com/kubewharf/katalyst-core/pkg/config/agent/qrm"
2324
)
2425

2526
type GenericQRMPluginOptions struct {
2627
QRMPluginSocketDirs []string
27-
StateFileDirectory string
2828
ExtraStateFileAbsPath string
2929
PodDebugAnnoKeys []string
3030
UseKubeletReservedConfig bool
3131
PodAnnotationKeptKeys []string
3232
PodLabelKeptKeys []string
3333
EnableReclaimNUMABinding bool
3434
EnableSNBHighNumaPreference bool
35-
EnableInMemoryState bool
35+
*statedirectory.StateDirectoryOptions
3636
}
3737

3838
func NewGenericQRMPluginOptions() *GenericQRMPluginOptions {
3939
return &GenericQRMPluginOptions{
4040
QRMPluginSocketDirs: []string{"/var/lib/kubelet/plugins_registry"},
41-
StateFileDirectory: "/var/lib/katalyst/qrm_advisor",
4241
PodDebugAnnoKeys: []string{},
4342
PodAnnotationKeptKeys: []string{},
4443
PodLabelKeptKeys: []string{},
44+
StateDirectoryOptions: statedirectory.NewStateDirectoryOptions(),
4545
}
4646
}
4747

@@ -50,7 +50,6 @@ func (o *GenericQRMPluginOptions) AddFlags(fss *cliflag.NamedFlagSets) {
5050

5151
fs.StringSliceVar(&o.QRMPluginSocketDirs, "qrm-socket-dirs",
5252
o.QRMPluginSocketDirs, "socket file directories that qrm plugins communicate witch other components")
53-
fs.StringVar(&o.StateFileDirectory, "qrm-state-dir", o.StateFileDirectory, "Directory that qrm plugins are using")
5453
fs.StringVar(&o.ExtraStateFileAbsPath, "qrm-extra-state-file", o.ExtraStateFileAbsPath, "The absolute path to an extra state file to specify cpuset.mems for specific pods")
5554
fs.StringSliceVar(&o.PodDebugAnnoKeys, "qrm-pod-debug-anno-keys",
5655
o.PodDebugAnnoKeys, "pod annotations keys to identify the pod is a debug pod, and qrm plugins will apply specific strategy to it")
@@ -64,21 +63,22 @@ func (o *GenericQRMPluginOptions) AddFlags(fss *cliflag.NamedFlagSets) {
6463
o.EnableReclaimNUMABinding, "if set true, reclaim pod will be allocated on a specific NUMA node best-effort, otherwise, reclaim pod will be allocated on multi NUMA nodes")
6564
fs.BoolVar(&o.EnableSNBHighNumaPreference, "enable-snb-high-numa-preference",
6665
o.EnableSNBHighNumaPreference, "default false,if set true, snb pod will be preferentially allocated on high numa node")
67-
fs.BoolVar(&o.EnableInMemoryState, "qrm-enable-in-memory-state",
68-
o.EnableInMemoryState, "if set true, the state will be stored in tmpfs")
66+
o.StateDirectoryOptions.AddFlags(fss)
6967
}
7068

7169
func (o *GenericQRMPluginOptions) ApplyTo(conf *qrmconfig.GenericQRMPluginConfiguration) error {
7270
conf.QRMPluginSocketDirs = o.QRMPluginSocketDirs
73-
conf.StateFileDirectory = o.StateFileDirectory
7471
conf.ExtraStateFileAbsPath = o.ExtraStateFileAbsPath
7572
conf.PodDebugAnnoKeys = o.PodDebugAnnoKeys
7673
conf.UseKubeletReservedConfig = o.UseKubeletReservedConfig
7774
conf.PodAnnotationKeptKeys = append(conf.PodAnnotationKeptKeys, o.PodAnnotationKeptKeys...)
7875
conf.PodLabelKeptKeys = append(conf.PodLabelKeptKeys, o.PodLabelKeptKeys...)
7976
conf.EnableReclaimNUMABinding = o.EnableReclaimNUMABinding
8077
conf.EnableSNBHighNumaPreference = o.EnableSNBHighNumaPreference
81-
conf.EnableInMemoryState = o.EnableInMemoryState
78+
79+
if err := o.StateDirectoryOptions.ApplyTo(conf.StateDirectoryConfiguration); err != nil {
80+
return err
81+
}
8282

8383
return nil
8484
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
Copyright 2022 The Katalyst Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package statedirectory
18+
19+
import (
20+
"github.com/kubewharf/katalyst-core/pkg/config/agent/qrm/statedirectory"
21+
cliflag "k8s.io/component-base/cli/flag"
22+
)
23+
24+
type StateDirectoryOptions struct {
25+
StateFileDirectory string
26+
InMemoryStateFileDirectory string
27+
EnableInMemoryState bool
28+
}
29+
30+
func NewStateDirectoryOptions() *StateDirectoryOptions {
31+
return &StateDirectoryOptions{
32+
StateFileDirectory: "/var/lib/katalyst/qrm_advisor",
33+
InMemoryStateFileDirectory: "/dev/shm/qrm/state",
34+
}
35+
}
36+
37+
func (o *StateDirectoryOptions) AddFlags(fss *cliflag.NamedFlagSets) {
38+
fs := fss.FlagSet("qrm_state_directory")
39+
40+
fs.StringVar(&o.StateFileDirectory, "qrm-state-dir", o.StateFileDirectory, "The directory to store the state file.")
41+
fs.StringVar(&o.InMemoryStateFileDirectory, "qrm-state-dir-in-memory",
42+
o.InMemoryStateFileDirectory, "The in memory directory to store the state file.")
43+
fs.BoolVar(&o.EnableInMemoryState, "qrm-enable-in-memory-state",
44+
o.EnableInMemoryState, "if set true, the state will be stored in the in-memory directory.")
45+
}
46+
47+
func (o *StateDirectoryOptions) ApplyTo(conf *statedirectory.StateDirectoryConfiguration) error {
48+
conf.StateFileDirectory = o.StateFileDirectory
49+
conf.InMemoryStateFileDirectory = o.InMemoryStateFileDirectory
50+
conf.EnableInMemoryState = o.EnableInMemoryState
51+
return nil
52+
}

pkg/agent/qrm-plugins/cpu/dynamicpolicy/cpueviction/cpu_eviciton_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323
"testing"
2424
"time"
2525

26+
"github.com/kubewharf/katalyst-core/pkg/config/agent/qrm/statedirectory"
27+
2628
"github.com/stretchr/testify/require"
2729

2830
qrmstate "github.com/kubewharf/katalyst-core/pkg/agent/qrm-plugins/cpu/dynamicpolicy/state"
@@ -50,10 +52,13 @@ func makeMetaServer(metricsFetcher types.MetricsFetcher, cpuTopology *machine.CP
5052

5153
func makeState(topo *machine.CPUTopology) (qrmstate.State, error) {
5254
tmpDir, err := os.MkdirTemp("", "checkpoint-makeState")
55+
stateDirectoryConfig := &statedirectory.StateDirectoryConfiguration{
56+
StateFileDirectory: tmpDir,
57+
}
5358
if err != nil {
5459
return nil, fmt.Errorf("make tmp dir for checkpoint failed with error: %v", err)
5560
}
56-
return qrmstate.NewCheckpointState(tmpDir, "test", "test", topo, false, qrmstate.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
61+
return qrmstate.NewCheckpointState(stateDirectoryConfig, "test", "test", topo, false, qrmstate.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
5762
}
5863

5964
func TestNewCPUPressureEviction(t *testing.T) {

pkg/agent/qrm-plugins/cpu/dynamicpolicy/cpueviction/strategy/pressure_load_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import (
2424
"testing"
2525
"time"
2626

27+
"github.com/kubewharf/katalyst-core/pkg/config/agent/qrm/statedirectory"
28+
2729
"github.com/stretchr/testify/assert"
2830
"github.com/stretchr/testify/require"
2931
v1 "k8s.io/api/core/v1"
@@ -102,10 +104,13 @@ func makeConf(metricRingSize int, gracePeriod int64, loadUpperBoundRatio, loadLo
102104

103105
func makeState(topo *machine.CPUTopology) (qrmstate.State, error) {
104106
tmpDir, err := os.MkdirTemp("", "checkpoint-makeState")
107+
stateDirectoryConfig := &statedirectory.StateDirectoryConfiguration{
108+
StateFileDirectory: tmpDir,
109+
}
105110
if err != nil {
106111
return nil, fmt.Errorf("make tmp dir for checkpoint failed with error: %v", err)
107112
}
108-
return qrmstate.NewCheckpointState(tmpDir, "test", "test", topo, false, qrmstate.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
113+
return qrmstate.NewCheckpointState(stateDirectoryConfig, "test", "test", topo, false, qrmstate.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
109114
}
110115

111116
func TestNewCPUPressureLoadEviction(t *testing.T) {

pkg/agent/qrm-plugins/cpu/dynamicpolicy/cpueviction/strategy/pressure_numa_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import (
2525
"testing"
2626
"time"
2727

28+
"github.com/kubewharf/katalyst-core/pkg/config/agent/qrm/statedirectory"
29+
2830
"github.com/stretchr/testify/assert"
2931
v1 "k8s.io/api/core/v1"
3032
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -94,7 +96,10 @@ func TestNumaCPUPressureEviction_update(t *testing.T) {
9496
defer os.RemoveAll(testingDir)
9597

9698
cpuTopology, _ := machine.GenerateDummyCPUTopology(16, 2, 4)
97-
state1, _ := state.NewCheckpointState(testingDir, "test", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
99+
stateDirectoryConfig := &statedirectory.StateDirectoryConfiguration{
100+
StateFileDirectory: testingDir,
101+
}
102+
state1, _ := state.NewCheckpointState(stateDirectoryConfig, "test", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
98103

99104
podEntry := state.PodEntries{
100105
"pod1": state.ContainerEntries{

pkg/agent/qrm-plugins/cpu/dynamicpolicy/hintoptimizer/policy/canonical/optimizer_test.go

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222
"os"
2323
"testing"
2424

25+
"github.com/kubewharf/katalyst-core/pkg/config/agent/qrm/statedirectory"
26+
2527
"github.com/stretchr/testify/assert"
2628
"github.com/stretchr/testify/require"
2729
pluginapi "k8s.io/kubelet/pkg/apis/resourceplugin/v1alpha1"
@@ -50,7 +52,10 @@ func TestNewCanonicalHintOptimizer(t *testing.T) {
5052
require.NoError(t, err)
5153
defer os.RemoveAll(tmpDir)
5254

53-
stateImpl, err := state.NewCheckpointState(tmpDir, "test", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
55+
stateDirectoryConfig := &statedirectory.StateDirectoryConfiguration{
56+
StateFileDirectory: tmpDir,
57+
}
58+
stateImpl, err := state.NewCheckpointState(stateDirectoryConfig, "test", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
5459
require.NoError(t, err)
5560

5661
options := policy.HintOptimizerFactoryOptions{
@@ -77,6 +82,9 @@ func TestCanonicalHintOptimizer_OptimizeHints(t *testing.T) {
7782
tmpDir, _ := ioutil.TempDir("", "test-canonical-hint-optimizer")
7883
defer os.RemoveAll(tmpDir)
7984

85+
stateDirectoryConfig := &statedirectory.StateDirectoryConfiguration{
86+
StateFileDirectory: tmpDir,
87+
}
8088
type fields struct {
8189
state state.State
8290
reservedCPUs machine.CPUSet
@@ -142,7 +150,7 @@ func TestCanonicalHintOptimizer_OptimizeHints(t *testing.T) {
142150
1: &state.NUMANodeState{DefaultCPUSet: machine.NewCPUSet(5, 6, 7, 8), PodEntries: make(state.PodEntries)},
143151
}
144152
cpuTopology, _ := machine.GenerateDummyCPUTopology(16, 1, 2) // 2 NUMA node
145-
st, _ := state.NewCheckpointState(tmpDir, "policy_packing", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
153+
st, _ := state.NewCheckpointState(stateDirectoryConfig, "policy_packing", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
146154
st.SetMachineState(ms, false)
147155
return st
148156
}(),
@@ -180,7 +188,7 @@ func TestCanonicalHintOptimizer_OptimizeHints(t *testing.T) {
180188
1: &state.NUMANodeState{DefaultCPUSet: machine.NewCPUSet(5, 6, 7, 8), PodEntries: make(state.PodEntries)}, // 4 CPUs
181189
}
182190
cpuTopology, _ := machine.GenerateDummyCPUTopology(16, 1, 2) // 2 NUMA node
183-
st, _ := state.NewCheckpointState(tmpDir, "policy_packing_one_NUMA_insufficient", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
191+
st, _ := state.NewCheckpointState(stateDirectoryConfig, "policy_packing_one_NUMA_insufficient", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
184192
st.SetMachineState(ms, false)
185193
return st
186194
}(),
@@ -217,7 +225,7 @@ func TestCanonicalHintOptimizer_OptimizeHints(t *testing.T) {
217225
1: &state.NUMANodeState{DefaultCPUSet: machine.NewCPUSet(5, 6, 7, 8), PodEntries: make(state.PodEntries)}, // 4 CPUs, 3 left
218226
}
219227
cpuTopology, _ := machine.GenerateDummyCPUTopology(16, 1, 2) // 2 NUMA node
220-
st, _ := state.NewCheckpointState(tmpDir, "policy_spreading", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
228+
st, _ := state.NewCheckpointState(stateDirectoryConfig, "policy_spreading", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
221229
st.SetMachineState(ms, false)
222230
return st
223231
}(),
@@ -255,7 +263,7 @@ func TestCanonicalHintOptimizer_OptimizeHints(t *testing.T) {
255263
1: &state.NUMANodeState{DefaultCPUSet: machine.NewCPUSet(5, 6, 7, 8), PodEntries: make(state.PodEntries)}, // 4 CPUs, available ratio 1.0
256264
}
257265
cpuTopology, _ := machine.GenerateDummyCPUTopology(16, 1, 2) // 2 NUMA node
258-
st, _ := state.NewCheckpointState(tmpDir, "policy_dynamic_packing_all_above_threshold", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
266+
st, _ := state.NewCheckpointState(stateDirectoryConfig, "policy_dynamic_packing_all_above_threshold", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
259267
st.SetMachineState(ms, false)
260268
return st
261269
}(),
@@ -329,7 +337,7 @@ func TestCanonicalHintOptimizer_OptimizeHints(t *testing.T) {
329337
},
330338
}
331339
cpuTopology, _ := machine.GenerateDummyCPUTopology(16, 1, 2) // 2 NUMA node
332-
st, _ := state.NewCheckpointState(tmpDir, "policy_dynamic_packing_one_below_threshold", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
340+
st, _ := state.NewCheckpointState(stateDirectoryConfig, "policy_dynamic_packing_one_below_threshold", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
333341
st.SetMachineState(ms, false)
334342
return st
335343
}(),
@@ -403,7 +411,7 @@ func TestCanonicalHintOptimizer_OptimizeHints(t *testing.T) {
403411
},
404412
}
405413
cpuTopology, _ := machine.GenerateDummyCPUTopology(16, 1, 2) // 2 NUMA node
406-
st, _ := state.NewCheckpointState(tmpDir, "policy_dynamic_packing_all_below_threshold_fallback_to_spreading", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
414+
st, _ := state.NewCheckpointState(stateDirectoryConfig, "policy_dynamic_packing_all_below_threshold_fallback_to_spreading", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
407415
st.SetMachineState(ms, false)
408416
return st
409417
}(),
@@ -444,7 +452,7 @@ func TestCanonicalHintOptimizer_OptimizeHints(t *testing.T) {
444452
1: &state.NUMANodeState{DefaultCPUSet: machine.NewCPUSet(5, 6, 7, 8), PodEntries: make(state.PodEntries)}, // 4 CPUs, 3 left
445453
}
446454
cpuTopology, _ := machine.GenerateDummyCPUTopology(16, 1, 2) // 2 NUMA node
447-
st, _ := state.NewCheckpointState(tmpDir, "unknown_policy_fallback_to_spreading", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
455+
st, _ := state.NewCheckpointState(stateDirectoryConfig, "unknown_policy_fallback_to_spreading", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
448456
st.SetMachineState(ms, false)
449457
return st
450458
}(),
@@ -481,7 +489,7 @@ func TestCanonicalHintOptimizer_OptimizeHints(t *testing.T) {
481489
1: &state.NUMANodeState{DefaultCPUSet: machine.NewCPUSet(5), PodEntries: make(state.PodEntries)}, // 1 CPU
482490
}
483491
cpuTopology, _ := machine.GenerateDummyCPUTopology(16, 1, 2) // 2 NUMA node
484-
st, _ := state.NewCheckpointState(tmpDir, "no_available_NUMA_nodes_after_filtering", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
492+
st, _ := state.NewCheckpointState(stateDirectoryConfig, "no_available_NUMA_nodes_after_filtering", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
485493
st.SetMachineState(ms, false)
486494
return st
487495
}(),
@@ -516,7 +524,7 @@ func TestCanonicalHintOptimizer_OptimizeHints(t *testing.T) {
516524
2: &state.NUMANodeState{DefaultCPUSet: machine.NewCPUSet(10), PodEntries: make(state.PodEntries)}, // 1 left
517525
}
518526
cpuTopology, _ := machine.GenerateDummyCPUTopology(12, 1, 3) // 3 NUMA node
519-
st, _ := state.NewCheckpointState(tmpDir, "policy_packing_multiple_preferred_due_to_same_minLeft", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
527+
st, _ := state.NewCheckpointState(stateDirectoryConfig, "policy_packing_multiple_preferred_due_to_same_minLeft", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
520528
st.SetMachineState(ms, false)
521529
return st
522530
}(),
@@ -555,7 +563,7 @@ func TestCanonicalHintOptimizer_OptimizeHints(t *testing.T) {
555563
2: &state.NUMANodeState{DefaultCPUSet: machine.NewCPUSet(10), PodEntries: make(state.PodEntries)}, // 1 left
556564
}
557565
cpuTopology, _ := machine.GenerateDummyCPUTopology(16, 1, 2) // 2 NUMA node
558-
st, _ := state.NewCheckpointState(tmpDir, "policy_spreading_multiple_preferred_due_to_same_maxLeft", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
566+
st, _ := state.NewCheckpointState(stateDirectoryConfig, "policy_spreading_multiple_preferred_due_to_same_maxLeft", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
559567
st.SetMachineState(ms, false)
560568
return st
561569
}(),
@@ -595,7 +603,7 @@ func TestCanonicalHintOptimizer_OptimizeHints(t *testing.T) {
595603
1: &state.NUMANodeState{DefaultCPUSet: machine.NewCPUSet(5, 6, 7, 8), PodEntries: make(state.PodEntries)},
596604
}
597605
cpuTopology, _ := machine.GenerateDummyCPUTopology(16, 1, 2) // 2 NUMA node
598-
st, _ := state.NewCheckpointState(tmpDir, "dynamic_packing_reserved_CPUs_affect_availability", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
606+
st, _ := state.NewCheckpointState(stateDirectoryConfig, "dynamic_packing_reserved_CPUs_affect_availability", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
599607
st.SetMachineState(ms, false)
600608
return st
601609
}(),
@@ -660,7 +668,7 @@ func TestCanonicalHintOptimizer_OptimizeHints(t *testing.T) {
660668
},
661669
}
662670
cpuTopology, _ := machine.GenerateDummyCPUTopology(16, 1, 2) // 2 NUMA node
663-
st, _ := state.NewCheckpointState(tmpDir, "dynamic_packing_one_NUMA_filtered_out_due_to_threshold_reserved_CPUs_considered", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
671+
st, _ := state.NewCheckpointState(stateDirectoryConfig, "dynamic_packing_one_NUMA_filtered_out_due_to_threshold_reserved_CPUs_considered", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
664672
st.SetMachineState(ms, false)
665673
return st
666674
}(),
@@ -702,7 +710,7 @@ func TestCanonicalHintOptimizer_OptimizeHints(t *testing.T) {
702710
1: &state.NUMANodeState{DefaultCPUSet: machine.NewCPUSet(3, 4), PodEntries: make(state.PodEntries)},
703711
}
704712
cpuTopology, _ := machine.GenerateDummyCPUTopology(16, 1, 2) // 2 NUMA node
705-
st, _ := state.NewCheckpointState(tmpDir, "dynamic_packing_allocatableCPUQuantity_is_zero_for_a_NUMA", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{}, false)
713+
st, _ := state.NewCheckpointState(stateDirectoryConfig, "dynamic_packing_allocatableCPUQuantity_is_zero_for_a_NUMA", "test", cpuTopology, false, state.GenerateMachineStateFromPodEntries, metrics.DummyMetrics{})
706714
st.SetMachineState(ms, false)
707715
return st
708716
}(),

pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ func NewDynamicPolicy(agentCtx *agent.GenericContext, conf *config.Configuration
156156
Val: cpuconsts.CPUResourcePluginPolicyNameDynamic,
157157
})
158158

159-
stateImpl, stateErr := state.NewCheckpointState(conf.GenericQRMPluginConfiguration.StateFileDirectory, cpuPluginStateFileName,
160-
cpuconsts.CPUResourcePluginPolicyNameDynamic, agentCtx.CPUTopology, conf.SkipCPUStateCorruption, state.GenerateMachineStateFromPodEntries, wrappedEmitter, conf.GenericQRMPluginConfiguration.EnableInMemoryState)
159+
stateImpl, stateErr := state.NewCheckpointState(conf.StateDirectoryConfiguration, cpuPluginStateFileName,
160+
cpuconsts.CPUResourcePluginPolicyNameDynamic, agentCtx.CPUTopology, conf.SkipCPUStateCorruption, state.GenerateMachineStateFromPodEntries, wrappedEmitter)
161161
if stateErr != nil {
162162
return false, agent.ComponentStub{}, fmt.Errorf("NewCheckpointState failed with error: %v", stateErr)
163163
}

0 commit comments

Comments
 (0)