Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UT not be properly executed during CI phase #911

Merged
merged 69 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
c18680c
update ci and initdevices logic
archlitchi Nov 15, 2024
856bcac
update devices
archlitchi Nov 15, 2024
577f93f
prepare to update v2.4.1
archlitchi Nov 15, 2024
be2ff8a
Merge branch 'Project-HAMi:master' into master
archlitchi Nov 15, 2024
a453160
update vGPUmonitor to add dynamic adjustment on core and memory limit
archlitchi Nov 18, 2024
29e7a74
Merge branch 'Project-HAMi:master' into master
archlitchi Nov 18, 2024
c7df495
Merge branch 'Project-HAMi:master' into master
archlitchi Nov 22, 2024
64e5a73
Merge branch 'Project-HAMi:master' into master
archlitchi Nov 27, 2024
dbdf4da
Merge branch 'Project-HAMi:master' into master
archlitchi Nov 29, 2024
33113b2
update
archlitchi Nov 29, 2024
d895719
Merge branch 'Project-HAMi:master' into master
archlitchi Nov 29, 2024
13486f1
Merge branch 'Project-HAMi:master' into master
archlitchi Dec 12, 2024
a078f1f
Merge branch 'Project-HAMi:master' into master
archlitchi Dec 16, 2024
c794210
Merge branch 'Project-HAMi:master' into master
archlitchi Dec 16, 2024
2ce717d
fix chart can't be deployed properly
archlitchi Dec 16, 2024
f5b2591
fix chart can't be deployed properly
archlitchi Dec 16, 2024
baf2c87
Merge branch 'Project-HAMi:master' into master
archlitchi Dec 16, 2024
0ff2c42
fix nodelock issues
archlitchi Dec 17, 2024
566ceca
update dynamic-mig document and examples
archlitchi Dec 19, 2024
98ecaa9
update dynamic-mig document and examples
archlitchi Dec 19, 2024
a66fad0
update dynamic-mig document and examples
archlitchi Dec 19, 2024
f83861c
Merge branch 'Project-HAMi:master' into master
archlitchi Dec 19, 2024
9f9f8b0
update documents
archlitchi Dec 23, 2024
c6ddcad
Merge branch 'master' of github.com:archlitchi/HAMi
archlitchi Dec 23, 2024
cecd68a
Merge branch 'Project-HAMi:master' into master
archlitchi Dec 23, 2024
ae22e81
update nodelock for mig instance & add document for mig monitor
archlitchi Dec 24, 2024
c3c49d8
Merge branch 'master' of github.com:archlitchi/HAMi
archlitchi Dec 24, 2024
a023937
Merge branch 'Project-HAMi:master' into master
archlitchi Dec 24, 2024
24eea30
Merge branch 'Project-HAMi:master' into master
archlitchi Dec 24, 2024
925b5da
update documents
archlitchi Dec 24, 2024
26b8680
Merge branch 'master' of github.com:archlitchi/HAMi
archlitchi Dec 24, 2024
4efa365
update documents for config
archlitchi Dec 24, 2024
336f83f
Merge branch 'master' of github.com:archlitchi/HAMi
archlitchi Jan 22, 2025
9b0f152
update docs and mig-related logics
archlitchi Jan 24, 2025
44cf07c
update docs
archlitchi Jan 24, 2025
b51d2a7
update docs
archlitchi Jan 24, 2025
fef2951
update libvgpu_so
archlitchi Jan 24, 2025
ea06f21
Merge branch 'Project-HAMi:master' into master
archlitchi Jan 24, 2025
cb2f31e
Merge branch 'Project-HAMi:master' into master
archlitchi Jan 24, 2025
39cff0c
update
archlitchi Jan 24, 2025
22cc9a7
Merge branch 'master' of github.com:archlitchi/HAMi
archlitchi Jan 24, 2025
500b60d
update ci
archlitchi Jan 25, 2025
6be7ab7
update ci
archlitchi Jan 25, 2025
bb935a9
Merge branch 'Project-HAMi:master' into master
archlitchi Jan 25, 2025
db35e26
update ci
archlitchi Jan 25, 2025
93664ac
Merge branch 'master' of github.com:archlitchi/HAMi
archlitchi Jan 25, 2025
2eb17ef
update
archlitchi Jan 25, 2025
e50963f
update
archlitchi Jan 25, 2025
6455e6c
update
archlitchi Jan 25, 2025
6e3291c
update
archlitchi Jan 25, 2025
4158642
update ci
archlitchi Jan 25, 2025
bd80c56
update ci
archlitchi Jan 25, 2025
12b0b24
Merge branch 'Project-HAMi:master' into master
archlitchi Jan 25, 2025
b076c9b
update ci
archlitchi Jan 25, 2025
facc1ce
Merge branch 'Project-HAMi:master' into master
archlitchi Jan 25, 2025
e529ba3
update ci
archlitchi Jan 25, 2025
b3bf09a
Merge branch 'Project-HAMi:master' into master
archlitchi Feb 5, 2025
2e2e695
update dockerfile
archlitchi Feb 5, 2025
262cf95
Merge branch 'Project-HAMi:master' into master
archlitchi Feb 5, 2025
f97dd35
fix scheduler crash on mig-mode task running on a hami-core gpu
archlitchi Feb 5, 2025
ef74086
Merge branch 'master' of github.com:archlitchi/HAMi
archlitchi Feb 5, 2025
f540e0f
Merge branch 'Project-HAMi:master' into master
archlitchi Feb 5, 2025
4c6059e
Merge branch 'Project-HAMi:master' into master
archlitchi Feb 6, 2025
8a10b00
Merge branch 'Project-HAMi:master' into master
archlitchi Feb 17, 2025
7fb13ad
update libvgpu
archlitchi Feb 17, 2025
b874d70
fix make test not working properly
archlitchi Mar 4, 2025
b770801
fix make test not working properly
archlitchi Mar 4, 2025
44cb27a
Merge branch 'Project-HAMi:master' into master
archlitchi Mar 4, 2025
fc4e018
update ut
archlitchi Mar 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ libvgpu.so
vendor
license
vgpuvalidator
_output/coverage/coverage_pkg.txt
_output/
coverage.out
.DS_Store
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ clean:
$(GO) clean -r -x ./cmd/...
-rm -rf $(OUTPUT_DIR)

.PHONY: all build docker clean $(CMDS)
.PHONY: all build docker clean test $(CMDS)

test:
mkdir -p ./_output/coverage/
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ require (
github.com/prometheus/client_golang v1.18.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
github.com/urfave/cli/v2 v2.27.1
golang.org/x/net v0.35.0
Expand All @@ -26,6 +27,7 @@ require (
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.33.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
gotest.tools/v3 v3.5.1
k8s.io/api v0.29.3
k8s.io/apimachinery v0.29.3
Expand Down Expand Up @@ -72,7 +74,6 @@ require (
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.13.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/mod v0.17.0 // indirect
Expand All @@ -84,7 +85,6 @@ require (
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/kube-openapi v0.0.0-20240227032403-f107216b40e2 // indirect
k8s.io/utils v0.0.0-20240102154912-e7106e64919e // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
Expand Down
20 changes: 1 addition & 19 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ=
Expand All @@ -189,10 +185,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand All @@ -204,28 +198,16 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA=
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
Expand Down
2 changes: 1 addition & 1 deletion libvgpu
14 changes: 5 additions & 9 deletions pkg/device/cambricon/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,18 @@
return nil
}

patchData := []byte(`[
{
"op": "remove",
"path": "/metadata/annotations/cambricon.com~1dsmlu.lock"
}
]`)

_, err := client.GetClient().CoreV1().Nodes().Patch(context.TODO(), n.Name, types.JSONPatchType, patchData, metav1.PatchOptions{})
newNode := n.DeepCopy()
delete(newNode.ObjectMeta.Annotations, DsmluLockTime)
_, err := client.GetClient().CoreV1().Nodes().Update(context.Background(), newNode, metav1.UpdateOptions{})
for i := 0; i < retry && err != nil; i++ {
klog.ErrorS(err, "Failed to patch node annotation", "node", n.Name, "retry", i)
time.Sleep(time.Duration(rand.Intn(i+1)) * 10 * time.Millisecond)
_, err = client.GetClient().CoreV1().Nodes().Patch(context.TODO(), n.Name, types.JSONPatchType, patchData, metav1.PatchOptions{})
_, err = client.GetClient().CoreV1().Nodes().Update(context.Background(), newNode, metav1.UpdateOptions{})

Check warning on line 164 in pkg/device/cambricon/device.go

View check run for this annotation

Codecov / codecov/patch

pkg/device/cambricon/device.go#L164

Added line #L164 was not covered by tests
}
if err != nil {
return fmt.Errorf("releaseNodeLock exceeds retry count %d", retry)
}
delete(n.ObjectMeta.Annotations, DsmluLockTime)
klog.InfoS("Node lock released", "node", n.Name)
return nil
}
Expand Down
11 changes: 2 additions & 9 deletions pkg/device/cambricon/device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,17 +480,9 @@ func Test_setNodeLock(t *testing.T) {
},
expectErr: false,
},
{
name: "no node name",
node: corev1.Node{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{},
},
},
expectErr: false,
},
}

client.KubeClient = fake.NewSimpleClientset()
k8sClient := client.GetClient()
if k8sClient != nil {

Expand Down Expand Up @@ -624,6 +616,7 @@ func Test_LockNode(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
node, pod, teardown, clientset := setupTest(t)
client.KubeClient = clientset
defer teardown()

// Set up the node with the specified annotations.
Expand Down
16 changes: 16 additions & 0 deletions pkg/device/devices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,21 @@ func createVNPUConfigs() []ascend.VNPUConfig {
{Name: "vir16", Memory: 17476, AICore: 16},
},
},
{
ChipName: "910B2",
CommonWord: "Ascend910B2",
ResourceName: "huawei.com/Ascend910B2",
ResourceMemoryName: "huawei.com/Ascend910B2-memory",
MemoryAllocatable: 65536,
MemoryCapacity: 65536,
AICore: 24,
AICPU: 6,
Templates: []ascend.Template{
{Name: "vir03_1c_8g", Memory: 8192, AICore: 3, AICPU: 1},
{Name: "vir06_1c_16g", Memory: 16384, AICore: 6, AICPU: 1},
{Name: "vir12_3c_32g", Memory: 32768, AICore: 12, AICPU: 3},
},
},
{
ChipName: "910B3",
CommonWord: "Ascend910B",
Expand Down Expand Up @@ -329,6 +344,7 @@ func setupTest(t *testing.T) (map[string]string, map[string]Devices) {
iluvatar.IluvatarGPUDevice: iluvatar.IluvatarGPUCommonWord,
mthreads.MthreadsGPUDevice: mthreads.MthreadsGPUCommonWord,
metax.MetaxGPUDevice: metax.MetaxGPUCommonWord,
metax.MetaxSGPUDevice: metax.MetaxSGPUCommonWord,
}

return expectedDevices, devicesMap
Expand Down
12 changes: 9 additions & 3 deletions pkg/util/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@
once sync.Once
)

func init() {
KubeClient = nil
}

func GetClient() kubernetes.Interface {
once.Do(func() {
var err error
KubeClient, err = newClient()
if err != nil {
klog.Fatalf("Failed to create Kubernetes client: %v", err)
if KubeClient == nil {
KubeClient, err = newClient()
if err != nil {
klog.Fatalf("Failed to create Kubernetes client: %v", err)
}

Check warning on line 47 in pkg/util/client/client.go

View check run for this annotation

Codecov / codecov/patch

pkg/util/client/client.go#L46-L47

Added lines #L46 - L47 were not covered by tests
}
})
return KubeClient
Expand Down
Loading