Skip to content

Commit

Permalink
updating malachite metric for supporting model inference
Browse files Browse the repository at this point in the history
  • Loading branch information
justadogistaken committed Nov 27, 2023
1 parent adf28be commit caf470c
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (

type BorweinOptions struct {
InferenceServiceSocketAbsPath string
NodeFeatureNames []string
ContainerFeatureNames []string
}

func NewBorweinOptions() *BorweinOptions {
Expand All @@ -34,11 +36,17 @@ func NewBorweinOptions() *BorweinOptions {
func (o *BorweinOptions) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&o.InferenceServiceSocketAbsPath, "borwein-inference-svc-socket-path", o.InferenceServiceSocketAbsPath,
"socket path which borwein inference server listens at")
fs.StringSliceVar(&o.NodeFeatureNames, "borwein-node-feature-names", o.NodeFeatureNames,
"borwein node feature name list")
fs.StringSliceVar(&o.ContainerFeatureNames, "borwein-container-feature-names", o.ContainerFeatureNames,
"borwein node feature name list")
}

// ApplyTo fills up config with options
func (o *BorweinOptions) ApplyTo(c *borwein.BorweinConfiguration) error {
// todo: currently BorweinParameters, NodeFeatureNames, ContainerFeatureNames are defined statically without options
// todo: currently BorweinParameters are defined statically without options
c.InferenceServiceSocketAbsPath = o.InferenceServiceSocketAbsPath
c.NodeFeatureNames = o.NodeFeatureNames
c.ContainerFeatureNames = o.ContainerFeatureNames
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ func (bmrf *BorweinModelResultFetcher) getInferenceRequestForPods(requestContain
}

nodeFeatureValue, err := getNodeFeatureValue(nodeFeatureName, metaServer, metaReader)

if err != nil {
return nil, fmt.Errorf("get node feature: %v failed with error: %v", nodeFeatureName, err)
}
Expand Down
14 changes: 4 additions & 10 deletions pkg/metaserver/agent/metric/malachite/client/client_cgroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,25 @@ var subSystemGroupsV2Data []byte

var (
subSystemGroupsV1 = &types.SubSystemGroupsV1{
Memory: types.MemoryCg{
Memory: types.MemoryCgV1{
V1: struct {
MemoryV1Data types.MemoryCgDataV1 `json:"V1"`
}(struct{ MemoryV1Data types.MemoryCgDataV1 }{MemoryV1Data: types.MemoryCgDataV1{}}),
},
Blkio: types.BlkioCg{
Blkio: types.BlkioCgV1{
V1: struct {
BlkIOData types.BlkIOCgDataV1 `json:"V1"`
}(struct{ BlkIOData types.BlkIOCgDataV1 }{BlkIOData: types.BlkIOCgDataV1{}}),
},
NetCls: types.NetClsCg{
NetData: types.NetClsCgData{},
},
PerfEvent: types.PerfEventCg{
PerfEventData: types.PerfEventData{},
},
Cpuset: types.CpusetCg{
Cpuset: types.CpusetCgV1{
V1: struct {
CPUSetData types.CPUSetCgDataV1 `json:"V1"`
}(struct{ CPUSetData types.CPUSetCgDataV1 }{CPUSetData: types.CPUSetCgDataV1{}}),
},
Cpuacct: types.CpuacctCg{
Cpuacct: types.CpuacctCgV1{
V1: struct {
CPUData types.CPUCgDataV1 `json:"V1"`
}(struct{ CPUData types.CPUCgDataV1 }{CPUData: types.CPUCgDataV1{}}),
Expand All @@ -75,9 +72,6 @@ var (
NetCls: types.NetClsCg{
NetData: types.NetClsCgData{},
},
PerfEvent: types.PerfEventCg{
PerfEventData: types.PerfEventData{},
},
Cpuset: types.CpusetCgV2{
V2: struct {
CPUSetData types.CPUSetCgDataV2 `json:"V2"`
Expand Down
22 changes: 10 additions & 12 deletions pkg/metaserver/agent/metric/malachite/fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,21 @@ func Test_noneExistMetricsFetcher(t *testing.T) {
fakeCgroupInfoV1 := &types.MalachiteCgroupInfo{
CgroupType: "V1",
V1: &types.MalachiteCgroupV1Info{
Memory: &types.MemoryCgDataV1{},
Blkio: &types.BlkIOCgDataV1{},
NetCls: &types.NetClsCgData{},
PerfEvent: &types.PerfEventData{},
CpuSet: &types.CPUSetCgDataV1{},
Cpu: &types.CPUCgDataV1{},
Memory: &types.MemoryCgDataV1{},
Blkio: &types.BlkIOCgDataV1{},
NetCls: &types.NetClsCgData{},
CpuSet: &types.CPUSetCgDataV1{},
Cpu: &types.CPUCgDataV1{},
},
}
fakeCgroupInfoV2 := &types.MalachiteCgroupInfo{
CgroupType: "V2",
V2: &types.MalachiteCgroupV2Info{
Memory: &types.MemoryCgDataV2{},
Blkio: &types.BlkIOCgDataV2{},
NetCls: &types.NetClsCgData{},
PerfEvent: &types.PerfEventData{},
CpuSet: &types.CPUSetCgDataV2{},
Cpu: &types.CPUCgDataV2{},
Memory: &types.MemoryCgDataV2{},
Blkio: &types.BlkIOCgDataV2{},
NetCls: &types.NetClsCgData{},
CpuSet: &types.CPUSetCgDataV2{},
Cpu: &types.CPUCgDataV2{},
},
}

Expand Down
16 changes: 16 additions & 0 deletions pkg/metaserver/agent/metric/malachite/types/cgroupv2.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2022 The Katalyst Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package types

// TODO better to have malachite provide a official data struct
Expand Down
16 changes: 16 additions & 0 deletions pkg/metaserver/agent/metric/malachite/types/common.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2022 The Katalyst Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package types

import "encoding/json"
Expand Down

0 comments on commit caf470c

Please sign in to comment.