Skip to content

Commit

Permalink
remove unused fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiling-J committed Dec 24, 2024
1 parent ec188e3 commit 8bd0791
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
1 change: 0 additions & 1 deletion common/types/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ type ModelRunReq struct {
MaxReplica int `json:"max_replica"`
Revision string `json:"revision"`
SecureLevel int `json:"secure_level"`
OrderDetailID int64 `json:"order_detail_id"`
}

var _ SensitiveRequestV2 = (*ModelRunReq)(nil)
Expand Down
1 change: 0 additions & 1 deletion common/types/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ type DeployRepo struct {
SKU string `json:"sku,omitempty"`
ResourceType string `json:"resource_type,omitempty"`
RepoTag string `json:"repo_tag,omitempty"`
OrderDetailID int64 `json:"order_detail_id,omitempty"`
}

type RuntimeFrameworkReq struct {
Expand Down
7 changes: 4 additions & 3 deletions component/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ func (c *modelComponentImpl) Deploy(ctx context.Context, deployReq types.DeployA
containerImg := c.containerImg(frame, hardware)

// create deploy for model
return c.deployer.Deploy(ctx, types.DeployRepo{
dp := types.DeployRepo{
DeployName: req.DeployName,
SpaceID: 0,
Path: m.Repository.Path,
Expand All @@ -964,8 +964,9 @@ func (c *modelComponentImpl) Deploy(ctx context.Context, deployReq types.DeployA
Type: deployReq.DeployType,
UserUUID: user.UUID,
SKU: strconv.FormatInt(resource.ID, 10),
OrderDetailID: req.OrderDetailID,
})
}
dp = modelRunUpdateDeployRepo(dp, req)
return c.deployer.Deploy(ctx, dp)
}

func (c *modelComponentImpl) ListModelsByRuntimeFrameworkID(ctx context.Context, currentUser string, per, page int, id int64, deployType int) ([]types.Model, int, error) {
Expand Down
4 changes: 4 additions & 0 deletions component/model_ce.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ func (c *modelComponentImpl) containerImg(frame *database.RuntimeFramework, hard
return containerImg

}

func modelRunUpdateDeployRepo(dp types.DeployRepo, req types.ModelRunReq) types.DeployRepo {
return dp
}
22 changes: 22 additions & 0 deletions component/model_ce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,25 @@ func TestModelComponent_Deploy(t *testing.T) {
require.Equal(t, int64(111), id)

}

func TestModelComponent_containerImg(t *testing.T) {
ctx := context.TODO()
mc := initializeTestModelComponent(ctx, t)

cases := []struct {
hd types.HardWare
img string
}{
{hd: types.HardWare{}, img: "cpu"},
{hd: types.HardWare{Gpu: types.GPU{}}, img: "cpu"},
{hd: types.HardWare{Gpu: types.GPU{Num: "1"}}, img: "gpu"},
}

for _, c := range cases {
v := mc.containerImg(&database.RuntimeFramework{
FrameImage: "gpu",
FrameCpuImage: "cpu",
}, c.hd)
require.Equal(t, c.img, v)
}
}

0 comments on commit 8bd0791

Please sign in to comment.